Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC: clarify stackplot limits #27335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2023
Merged

DOC: clarify stackplot limits #27335

merged 1 commit into from
Nov 27, 2023

Conversation

story645
Copy link
Member

PR summary

Y axis says it's million but numbers are in thousands, so trying to make y-axis show a million. (demo for a how to contribute talk)

PR checklist

@story645 story645 added the Documentation: examples files in galleries/examples label Nov 16, 2023
@QuLogic
Copy link
Member

QuLogic commented Nov 17, 2023

When the label has (millions) in it, it means multiply by 1e6 yourself. If you want to put the 1e6 back in, you'd need to remove the (millions) from the label.

@jklymak
Copy link
Member

jklymak commented Nov 17, 2023

I'm also not clear on the motivation here. The original example was correct.

@story645
Copy link
Member Author

story645 commented Nov 17, 2023

Yes the original example was correct, but it was unclear because the 1e6 multiplication was implicit and most of these numbers are in the billions. Was motivated to open this PR b/c I was showing this example in a seminar and was tripping over the yaxis.

@rcomer
Copy link
Member

rcomer commented Nov 21, 2023

Since the y-label states it's in millions I would not say it's implicit. However, I think if I were plotting these sorts of magnitudes then I would go the other way: divide by 1000 and change the y-label to say "billions". Would that make it less of a trip hazard?

@story645
Copy link
Member Author

story645 commented Nov 21, 2023

Would that make it less of a trip hazard?

Agree w. you that I think framing in billions is the cleanest here as it's the 7 thousand million that's causing me to do a double take.

@story645 story645 marked this pull request as ready for review November 21, 2023 17:51
@story645 story645 marked this pull request as draft November 21, 2023 18:12
@story645
Copy link
Member Author

converting back to draft because the decimal points aren't being displayed 🤦‍♀️

@jklymak
Copy link
Member

jklymak commented Nov 21, 2023

You could set a custom formatter. However, it is extremely common to specify values in millions (eg, quickly found example - https://www.apple.com/newsroom/pdfs/fy2023-q4/FY23_Q4_Consolidated_Financial_Statements.pdf). I am still not clear on the advantage of this change.

@story645
Copy link
Member Author

. I am still not clear on the advantage of this change.

In the example you link to, it's in millions to preserve the significant digits, but here we lose all those digits anyway b/c of the locator/formatter. I realized I'd been mixing up the formatters/locators w/ my data values (I blame sleep deprivation), and I think seeing 7000 million didn't help w/ that.
sphx_glr_stackplot_demo_001
Basically, if we're losing all the millions significant digits in the labeling then we may as well just label in the billions.

@story645 story645 marked this pull request as ready for review November 21, 2023 18:43
@story645
Copy link
Member Author

So ended up adding minor locator at every 100 million because that's what I think I was really after, an aide for reading off the count in each band width + billions since that's the significant figure the locator lands on

Untitled

@StefRe
Copy link
Contributor

StefRe commented Nov 21, 2023

My two cents:

  • the example Stackplots and streamgraphs is about stacking data, the axis labelling/scaling seems to be rather irrelevant in this respect
  • billion may be a bit ambiguous (1e9 or 1e12, at least for non-native speakers), although it's clear here in the given context of world population, so I'd either leave it as is or remove "(billions)" or "(millions)" from the label and use a multiplier offset instead.
  • I find the minor ticks aesthetically rather unappealing (too dense) and given that it's anyway quite hard to read off quantities from stack charts I don't think they add any real help in reading the chart.

Copy link
Member

@rcomer rcomer left a comment

Choose a reason for hiding this comment

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

I think the plot looks better this way (as I said, it’s what I would do). “five billion” feels more natural to me than “five thousand million”. I also think the plot looks less cluttered without all the zeros in the y tick labels.

Will hold off from merging as there are clearly differing opinions here.

[cross post with @StefRe]

@story645
Copy link
Member Author

that it's anyway quite hard to read off quantities from stack charts

Yes but you still want to get a sense of proportion and I think minor ticks help w/ grounding, but also changed the minor ticks to .2 to loosen it a bit & the upside is then it more or less lines up w/ the Africa count (which side note, fixed the capitalization).

@story645
Copy link
Member Author

the axis labelling/scaling seems to be rather irrelevant in this respect

Yes and no - the reason I opened this PR was b/c I was talking about this chart in a seminar (as an example of how the same chart can have different names - stackplot and area chart) and the labeling distracted from the discussion b/c it's a bit clunky.

@rcomer
Copy link
Member

rcomer commented Nov 27, 2023

Since no-one objects strongly enough to block, and @story645 has clearly explained the motivation for the change, I am going to go ahead and merge.

@rcomer rcomer merged commit 3997ebb into matplotlib:main Nov 27, 2023
@oscargus
Copy link
Member

oscargus commented Nov 27, 2023

People also write things like "10,000 MWh per day", so, yeah, unit handling isn't what it used to be.

(https://ourworldindata.org/scale-for-electricity)

@rcomer
Copy link
Member

rcomer commented Nov 27, 2023

People also write things like "10,000 MWh per day", so, yeah, unit handling isn't what it used to be.

(https://ourworldindata.org/scale-for-electricity)

😢

@story645 story645 deleted the fix-stack branch November 28, 2023 00:53
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.

7 participants