Skip to content

Figure.histogram: Let parameter 'cumulative' support Pythonic arguments - #4881

Open
seisman wants to merge 3 commits into
mainfrom
histogram/cumulative
Open

Figure.histogram: Let parameter 'cumulative' support Pythonic arguments#4881
seisman wants to merge 3 commits into
mainfrom
histogram/cumulative

Conversation

@seisman

@seisman seisman commented Sep 4, 2026

Copy link
Copy Markdown
Member

Migrate the parameter cumulative to the new alias system.

Previously, cumulative can be either True or "r". This PR lets it support more Pythonic argument, i.e., cumulative="reversed".

For comparison, here is matplotlib's hist method (https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.hist.html):

cumulativebool or -1, default: False
If True, then a histogram is computed where each bin gives the counts in that bin plus all bins for smaller values. The last bin gives the total number of datapoints.
If density is also True then the histogram is normalized such that the last bin equals 1.
If cumulative is a number less than 0 (e.g., -1), the direction of accumulation is reversed. In this case, if density is also True, then the histogram is normalized such that the first bin equals 1.

So, matplotlib uses cumulative=-1 for reversed cumulative histogram, but I feel it's not as readable as cumulative="reversed".

Preview:

@seisman seisman added this to the 0.20.0 milestone Sep 4, 2026
@seisman seisman added enhancement Improving an existing feature needs review This PR has higher priority and needs review. labels Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improving an existing feature needs review This PR has higher priority and needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant