Figure.histogram: Migrate parameter 'stairs' to the new alias system - #4884
Open
seisman wants to merge 1 commit into
Open
Figure.histogram: Migrate parameter 'stairs' to the new alias system#4884seisman wants to merge 1 commit into
seisman wants to merge 1 commit into
Conversation
37 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR migrates the
stairsparameter (option-S) to the new alias system.Over the past few days, I considered whether we should adopt Matplotlib's design (https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.hist.html), which exposes a
histtypeparameter accepting values"bars","stepfilled","step", and"barstacked"(but we already aliashisttypeto-Z). Matplotlib also provides an example demonstrating these histogram styles at https://matplotlib.org/stable/gallery/statistics/histogram_histtypes.html.It turns out GMT is more flexible: it can reproduce Matplotlib’s various histogram types via different combinations of
pen,fill, andstairs, as illustrated below. Thus, this PR is simply a routine parameter migration.Related: I feel we should add this image showing different types of histograms that GMT can provide. We already have a tutorial at https://www.pygmt.org/dev/tutorials/advanced/cartesian_histograms.html, which shows several histograms, but only one is shown in the API page (https://www.pygmt.org/dev/api/generated/pygmt.Figure.histogram.html#pygmt.Figure.histogram). Maybe we should add a separate gallery example instead?