Skip to content

Figure.fill_between: Support for non-coregistered curves#4692

Open
seisman wants to merge 2 commits into
mainfrom
fill_between/non-co-registrated
Open

Figure.fill_between: Support for non-coregistered curves#4692
seisman wants to merge 2 commits into
mainfrom
fill_between/non-co-registrated

Conversation

@seisman

@seisman seisman commented Jun 21, 2026

Copy link
Copy Markdown
Member

Now support two curves with different x-coodinates.

Examples

import pygmt
import numpy as np

x = np.linspace(0, 4, 100)
y = np.sin(5 * x)
x3 = np.array([0, 0.21, 0.4, 0.63, 0.89, 1.18, 1.45, 1.69, 1.96, 2.26, 2.61, 3.23, 3.49, 4.0])
y3 = 0.5 * np.cos(3 * x3)

fig = pygmt.Figure()
fig.basemap(region=[0, 4, -1.2, 1.2], projection="X10c/5c", frame=True)
fig.fill_between(
    x=x,
    y=y,
    x2=x3,
    y2=y3,
    fill="lightgreen",
    fill2="lightbrown",
    pen="1p,green",
    pen2="1p,brown",
    label="y=sin(5x)",
    label2="y=0.5*cos(3x)",
)
fig.plot(x=x, y=y, style="c0.06c", fill="green", pen="green")
fig.plot(x=x3, y=y3, style="c0.06c", fill="brown", pen="brown")
fig.legend()
fig.show()
fill

Related to #4678 and #4679

@seisman seisman added enhancement Improving an existing feature needs review This PR has higher priority and needs review. labels Jun 21, 2026
@seisman seisman added this to the 0.19.0 milestone Jun 21, 2026
@github-actions

github-actions Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary of changed images

This is an auto-generated report of images that have changed on the DVC remote

Status Path
added pygmt/tests/baseline/test_fill_between_noncoregistered.png
modified pygmt/tests/baseline/test_fill_between_coregistered.png
modified pygmt/tests/baseline/test_fill_between_y2_scalar.png

Image diff(s)

Details

Added images

  • test_fill_between_noncoregistered.png

Modified images

Path Old New
test_fill_between_coregistered.png
test_fill_between_y2_scalar.png

Report last updated at commit 7e8cff3

@seisman seisman deployed to pr-tests June 23, 2026 03:34 — with GitHub Actions Active
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