GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add \underline to mathtext by wesbarnett · Pull Request #15624 · matplotlib/matplotlib

Conversation

@wesbarnett

@wesbarnett wesbarnett commented Nov 7, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

PR Summary

Implements #14235 to add \underline to mathtext.

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

iago-lito and nicola-decao reacted with hooray emoji iago-lito reacted with heart emoji
All reactions
  • 🎉 2 reactions
  • ❤️ 1 reaction
@QuLogic QuLogic added status: work in progress topic: text/mathtext labels Nov 7, 2019
@story645 story645 added the mentored: hackathon label Nov 12, 2019
@pprasha

pprasha commented Mar 22, 2020

Copy link
Copy Markdown

let me take a look

nicola-decao reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jklymak
jklymak marked this pull request as draft July 23, 2020 03:22
anntzer and others added 25 commits September 12, 2021 14:02
@anntzer
Fix validate_markevery docstring markup.
f96a463
Make type lists fit in a single line.  A strict reading suggests that
all types should be separated with ` or ` rather than a comma, but
avoiding a backslash continuation seems more useful.

Also, *s* can also be a str.
@timhoffm
Merge pull request #21053 from anntzer/vme
47602ee
Fix validate_markevery docstring markup.
@timhoffm
Remove dummy test command from setup.py
2d2fcb4
This was introduced in 2015 when support for running nose tests via
`setup.py test` was removed. We do not need to explicitly tell people
anymore that this is not possible.
@dstansby
Merge pull request #21059 from timhoffm/cleanup-setup_py
23f1da4
Remove dummy test command from setup.py
@timhoffm
Correct the default for fillstyle parameter in MarkerStyle()
f630a73
@anntzer
Merge pull request #21060 from timhoffm/marker-default-fillstyle
f13147a
@deep-jkl
Fix typo in template of current dev-docs
72c9c00
@anntzer
Remove most visible dependencies on distutils.
b8aa5b2
They are instead replaced by slightly roundabout ways to get hold of the
same objects (CompilerError, CCompiler).

Only distutils.sysconfig remains; we should investigate whether the
stdlib's sysconfig is a satisfactory replacement for it.
@anntzer
Deprecate support for no-args MarkerStyle().
40de2cf
As noted in the module docstring, there is a confusion between using a
generic default MarkerStyle (empty) and the artist-specific one (e.g.
scatter plots use `rcParams["scatter.marker"]`).  Fortunately, direct
construction of MarkerStyles (especially of empty ones) is hardly ever
needed, so we can just make the parameter required.
@dstansby
Merge pull request #21062 from deep-jkl/typo-in-new-doc-template
d27fba3
Fix typo in template of current dev-docs
@jyjoshi @timhoffm
Update lib/mpl_toolkits/mplot3d/axes3d.py
cc2af22
Co-authored-by: Tim Hoffmann <[email protected]>
@story645 @dstansby
Update lib/matplotlib/colors.py
143c30e
Co-authored-by: David Stansby <[email protected]>
@jklymak
Merge pull request #21056 from anntzer/msn
2e34f38
Deprecate support for no-args MarkerStyle().
@timhoffm
Merge pull request #20913 from story645/story645-to_hex
20170d7
[Doc] colors.to_hex input & output
@anntzer
Support marker="none" to mean "no marker".
4cef945
As for other APIs, this is less likely to be confused with the None
object.
@jyjoshi
Docstring updated for scatter method
51438b2
@QuLogic
Merge pull request #20819 from hrnciar/wheels-py3.10
38bfebc
Add CPython 3.10 wheels
@QuLogic
Remove generated file accidentally added in #20867
55b0d93
@QuLogic
Use correct DPI when drawing in Cairo renderers
0c021c7
Unlike the Agg renderer, the Cairo renderer exists forever and is at the
DPI when the figure was created. This needs to be updated before drawing
or things in physical sizes (e.g., text or line widths) will be the
wrong size.
@jyjoshi
Added decorators to more methods in axes3d.py
ed53303
@QuLogic
Set device pixel ratio when saving a figure
630f25f
Otherwise, `FigureCanvasBase.get_width_height` returns a size scaled
down by the current pixel ratio, even though the DPI is not scaled up.
This causes the saved figure to be cropped.
@QuLogic
De-duplicate some unit conversion in Cairo
9598205
@story645
Merge pull request #21067 from QuLogic/delete-extra
592319e
Remove generated file accidentally added in #20867
@QuLogic
Merge pull request #21051 from anntzer/gdbdashes
1a0ebbb
set_dashes does not support offset=None anymore.
@QuLogic
Merge pull request #21049 from timhoffm/simplify-legend-attrs
fd3f25e
Simplify setting Legend attributes
@wesbarnett

wesbarnett commented Oct 5, 2021

Copy link
Copy Markdown
Author

@jklymak can you take a look? Super late getting to this, but I think it's done

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@wesbarnett

wesbarnett commented Oct 7, 2021

Copy link
Copy Markdown
Author

@QuLogic you can remove the "work in progress" tag for this. It's ready to be reviewed. Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anntzer anntzer removed the status: work in progress label Oct 7, 2021
@wesbarnett wesbarnett mentioned this pull request Oct 7, 2021
Add \underline to mathtext? #14235
Closed
jklymak
jklymak reviewed Oct 12, 2021
View reviewed changes
Comment thread lib/matplotlib/_mathtext.py
return [hlist]

def underline(self, s, loc, toks):
(body,), = toks

@jklymak jklymak Oct 12, 2021

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your perseverance with this. Is it possible the test coverage could hit these missing lines?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tacaswell
tacaswell force-pushed the main branch from f6e0ee4 to a1eef38 Compare October 20, 2021 19:55
@jklymak jklymak added status: needs rebase status: needs tests labels Nov 8, 2021
@jklymak
jklymak marked this pull request as draft November 8, 2021 09:26
@jklymak

jklymak commented Nov 8, 2021

Copy link
Copy Markdown
Member

@wesbarnett popping to draft until the rebase gets figured out.... You may need to follow instructions at https://discourse.matplotlib.org/t/default-branch-renamed-with-minor-edit-to-history/22367/2 Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tfpf

tfpf commented Aug 12, 2022

Copy link
Copy Markdown
Contributor

There haven't been any updates here for a while. Unless I am mistaken, this is not extremely hard to implement. The details are in node 735 of TeX, but it doesn't look that's what's happening here?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tfpf

tfpf commented Aug 14, 2022

Copy link
Copy Markdown
Contributor

I think mimicking TeX's behaviour is straightforward. Not sure how exactly overline works, but TeX puts a space between the text and the underline equal to thrice the thickness of the underline (even if the text has depth). Just adding vertical kerning should work?

I can open another pull request to implement it if that's okay.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@timhoffm

timhoffm commented Aug 14, 2022

Copy link
Copy Markdown
Member

I think mimicking TeX's behaviour is straightforward. Not sure how exactly overline works, but TeX puts a space between the text and the underline equal to thrice the thickness of the underline (even if the text has depth). Just adding vertical kerning should work?

I can open another pull request to implement it if that's okay.

I'm not a TeX expert, but if you have a straight-forward solution, please go ahead and open a new PR.

tfpf reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tfpf tfpf mentioned this pull request Aug 14, 2022
feat(mathtext): support underline #23616
Merged
5 tasks done
@github-actions

github-actions Bot commented Jun 30, 2023

Copy link
Copy Markdown

Since this Pull Request has not been updated in 60 days, it has been marked "inactive." This does not mean that it will be closed, though it may be moved to a "Draft" state. This helps maintainers prioritize their reviewing efforts. You can pick the PR back up anytime - please ping us if you need a review or guidance to move the PR forward! If you do not plan on continuing the work, please let us know so that we can either find someone to take the PR over, or close it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added the status: inactive Marked by the “Stale” Github Action label Jun 30, 2023
@melissawm

melissawm commented Jul 4, 2023

Copy link
Copy Markdown
Member

It looks like there are two PRs trying to solve the same issue here - this one and #23616. Any chance @wesbarnett and @tfpf could team up or review each other's work so this feature can move forward? Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rcomer

rcomer commented Jul 4, 2023

Copy link
Copy Markdown
Member

Looks like @tfpf opened the other PR because this one had stalled....

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tfpf

tfpf commented Jul 4, 2023

Copy link
Copy Markdown
Contributor

Initially, I though this approach could be improved by applying the make_under procedure of TeX (node 735 in TeX: the Program). To my utter surprise, wesbarnett's code (from here) and the TeX code (from #23616) produce the exact same images! Unless I have terribly messed something up, the PNG files are identical, byte for byte; the SVG files are also identical, at least visually.

w
w

import matplotlib.pyplot as plt
fig = plt.figure()
plt.text(.5, .5, r'$\underline{ul}$', size=50)
plt.axhline(.5)
plt.savefig('s.svg')
plt.savefig('p.png')
plt.show()

Note that the SVG and PNG backends render the image differently. I got stuck here, and documented it in #23763. Still unable to figure out why that happens.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

wesbarnett added 8 commits July 4, 2023 19:46
@wesbarnett
add back code to new location
0d36969
@wesbarnett
update documentation
87c0730
@wesbarnett
add tests
f6889cc
@wesbarnett
correct doc
5e23dc2
@wesbarnett
add whatsnew entry
ba67ed7
@wesbarnett
rm erroneous line
d7f6ad5
@wesbarnett
MathJax -> mathtext
827e09a
@wesbarnett
fix underline being too short
38e4a55
@wesbarnett

wesbarnett commented Jul 5, 2023

Copy link
Copy Markdown
Author

My PR is so far off with main at this point, I'm happy to close this as a duplicate of #23616. (My implementation was basically copying the overline functionality and making a few adjustments for it to be used as an underline.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@wesbarnett wesbarnett closed this Jul 5, 2023
@melissawm melissawm moved this from Waiting for author to Done in First Time Contributors Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jklymak jklymak jklymak left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

mentored: hackathon status: inactive Marked by the “Stale” Github Action status: needs rebase status: needs tests topic: text/mathtext

Projects

First Time Contributors
Status: Done

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

20 participants

@wesbarnett @pprasha @jklymak @tfpf @timhoffm @melissawm @rcomer @QuLogic @story645 @anntzer @dstansby @deep-jkl @jyjoshi @tacaswell @fariza @beckja @greglucas @pijyoi @fishmandev @isha614
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.