FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

DOC: Improve log scale example by timhoffm · Pull Request #29407 · matplotlib/matplotlib · GitHub

Repository navigation

DOC: Improve log scale example - #29407

Merged
timhoffm merged 1 commit into
matplotlib:mainfrom
timhoffm:doc-log-scale
Jan 8, 2025
Merged

timhoffm merged 1 commit into
matplotlib:mainfrom
timhoffm:doc-log-scale

Conversation

timhoffm commented Jan 5, 2025

Copy link
Copy Markdown
Member

github-actions Bot added the Documentation: examples files in galleries/examples label Jan 5, 2025
timhoffm added this to the v3.10.0-doc milestone Jan 5, 2025

scottshambaugh commented Jan 7, 2025 •
edited
Loading

Copy link
Copy Markdown
Contributor

New example image:

Maybe this is nitpicky, but could we have a "plain" semilogy plot next to the semilogx one? I think the base 2 labeling is super useful to include, but it takes some interpretation. It'd be nice to have a semilogy plot that you can see at a glance what's going on, and then the base 2 labeling plot could be kept but moved down.

It'd also be nice to have the minor gridlines turned on for one of these plots.

timhoffm commented Jan 7, 2025

Copy link
Copy Markdown
Member Author

Indeed a bit nitpicky. 😄 It's a bit the question of how much can you illustrate with an example.

The original example had the base 2 on the loglog plot. I found this very unfortunate because (1) I've never seed double-log plots with different bases. That seems quite exotic. (2) to get that, one had to use set_xscale after loglog, which is not quite instructive as you override the x log scale defined by loglog. I thought it's nice to keep the base 2 aspect somewhere, and the semilogy was the one where it was least confusing. But maybe it's better to leave the base 2 out here?

I also think that adding minor grids here would be too cluttered.

If we want to have all the aspects in, we probably need to structure the example into subsections:

  1. semilogx, semilogy, loglog
  2. base 2
  3. minor grids
  4. log with errorbars that get negative

Copy link
Copy Markdown
Contributor

However you want to slice it! I think it's definitely an improvement over what's there currently.

timhoffm force-pushed the doc-log-scale branch 2 times, most recently from 6adabd3 to 2c399be Compare January 8, 2025 21:55
- Remove https://matplotlib.org/stable/gallery/scales/semilogx_demo.html
  It is redundant to the other log scale example.
- Explain that semilogx/semilogy/loglog are shortcuts.
- Tune data/visualization

timhoffm commented Jan 8, 2025

Copy link
Copy Markdown
Member Author

@scottshambaugh I've reworked the example. There's now one plot with semilogx/semilogy/loglog, also containing minor grids, as that makes it more obvious which directions are logarithmic.

I've added separate examples base=2 and handling of non-positive values.

Copy link
Copy Markdown
Contributor

I think this looks great, breaking it up into sections was a good move and the exposition helps a lot to interpret what's going on. Good to merge unless you want another reviewer!

timhoffm merged commit 9a834ad into matplotlib:main Jan 8, 2025
timhoffm deleted the doc-log-scale branch January 8, 2025 22:41
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jan 8, 2025
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jan 8, 2025
timhoffm added a commit that referenced this pull request Jan 8, 2025
…407-on-v3.10.x

Backport PR #29407 on branch v3.10.x (DOC: Improve log scale example)
timhoffm added a commit that referenced this pull request Jan 8, 2025
…407-on-v3.10.0-doc

Backport PR #29407 on branch v3.10.0-doc (DOC: Improve log scale example)
ksunden mentioned this pull request Mar 3, 2025
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation: examples files in galleries/examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL