🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@timhoffm
Copy link
Member

@timhoffm timhoffm commented Jan 5, 2025

@github-actions github-actions bot added the Documentation: examples files in galleries/examples label Jan 5, 2025
@timhoffm timhoffm added this to the v3.10.0-doc milestone Jan 5, 2025
@scottshambaugh
Copy link
Contributor

scottshambaugh commented Jan 7, 2025

New example image:
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
Copy link
Member Author

timhoffm commented Jan 7, 2025

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

@scottshambaugh
Copy link
Contributor

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

@timhoffm 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
Copy link
Member Author

timhoffm commented Jan 8, 2025

@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.

@scottshambaugh
Copy link
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 timhoffm merged commit 9a834ad into matplotlib:main Jan 8, 2025
22 checks passed
@timhoffm 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 ksunden mentioned this pull request Mar 3, 2025
5 tasks
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