Skip to content

Figure.histogram: Let the parameter 'series' accept a sequence - #4899

Merged
seisman merged 7 commits into
mainfrom
parse_series
Oct 27, 2026
Merged

seisman merged 7 commits into
mainfrom
parse_series

Conversation

@seisman

@seisman seisman commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

See #4898 for context.

This PR implements a common function _parse_series to improve the -T option in histogram.

Now it's possible to use series=np.arange(0, 10, 1), which is more familiar to Python users.

Example

import numpy as np
import pygmt

rng = np.random.default_rng(seed=100)
data = rng.normal(loc=100, scale=25, size=521)
fig = pygmt.Figure()
fig.histogram(
    data=data,
    frame=True,
    # series=5,
    # series=[0, 200, 5],
    series=np.arange(0, 200, 5),
    fill="red3",
    pen="1p",
)
fig.show()

Related to #4251.

@seisman seisman changed the title POC + WIP: Figure.histogram: Let the parameter 'series' accept a sequence Figure.histogram: Let the parameter 'series' accept a sequence Oct 22, 2026
@seisman seisman added enhancement Improving an existing feature needs review This PR has higher priority and needs review. labels Oct 22, 2026
@seisman seisman added this to the 0.20.0 milestone Oct 22, 2026
@seisman
seisman marked this pull request as ready for review October 22, 2026 02:05
@seisman
seisman requested a review from a team October 22, 2026 02:05
@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Oct 26, 2026
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Oct 27, 2026
@seisman
seisman merged commit d3b3799 into main Oct 27, 2026
22 of 23 checks passed
@seisman
seisman deleted the parse_series branch October 27, 2026 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improving an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant