| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
|
||
| Only handles fully math and fully non-math strings. | ||
| """ | ||
| if s[:1] == s[-1:] == "$": |
There was a problem hiding this comment.
Any reason not to write if s[0] == s[-1] == "$"
Sorry, something went wrong.
There was a problem hiding this comment.
That was to handle empty strings as well (which do occur here if e.g. you disable offsettexts), but I realized this would still give the wrong result with s = "$". So I added an explicit check on len(s) instead.
Sorry, something went wrong.
There was a problem hiding this comment.
Looks good; needs tests, and an API note I think.
Sorry, something went wrong.
|
added whatsnew (it's not an API change) and test |
Sorry, something went wrong.
When a colorbar exists, use its formatter to format cursor data. For example, after ``` imshow([[10000, 10001]]); colorbar() ``` currently the cursor data on either pixel is rendered as 1e4, but after this patch it becomes 0.0+1e4 / 1.0+1e4, or 10000.0 / 10001.0 if `rcParams["axes.formatter.useoffset"]` is set to False. (Even though the version with the offset text may not be the most esthetic, it's clearly more informative than the current behavior...) It would be nice if this worked even for ScalarMappables that don't have a colorbar; this may include extracting the Formatter selection code out of the colorbar code into something generally applicable to ScalarMappables, or just generating a hidden colorbar "on-the-fly" if needed just for the purpose of getting its Formatter.
|
todo: confirm that nothing horrible happens with boundarynorms. |
Sorry, something went wrong.
|
Actually one can just try with examples/images_contours_and_fields/image_masked.py or examples/images_contours_and_fields/image_annotated_heatmap.py: BoundaryNorms work just fine with this PR. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
When a colorbar exists, use its formatter to format cursor data.
For example, after
currently the cursor data on either pixel is rendered as 1e4, but after
this patch it becomes 0.0+1e4 / 1.0+1e4, or 10000.0 / 10001.0 if
rcParams["axes.formatter.useoffset"] is set to False. (Even though
the version with the offset text may not be the most esthetic, it's
clearly more informative than the current behavior...)
It would be nice if this worked even for ScalarMappables that don't
have a colorbar; this may include extracting the Formatter selection
code out of the colorbar code into something generally applicable to
ScalarMappables, or just generating a hidden colorbar "on-the-fly" if
needed just for the purpose of getting its Formatter.
PR Summary
PR Checklist