Skip to content

Add gallery example showing how to fill the area between two curves#3168

Open
yvonnefroehlich wants to merge 17 commits intomainfrom
add-gallery-area-curves
Open

Add gallery example showing how to fill the area between two curves#3168
yvonnefroehlich wants to merge 17 commits intomainfrom
add-gallery-area-curves

Conversation

@yvonnefroehlich
Copy link
Copy Markdown
Member

@yvonnefroehlich yvonnefroehlich commented Apr 14, 2024

Description of proposed changes

This PR is converted to draft as a high-level method is planned for fill the area between two curves

-M of plot allows to fill the area between two curves with colors or patterns. This PR addes a gallery example showing how to do this:

Preview: https://pygmt-dev--3168.org.readthedocs.build/en/3168/gallery/lines/curves_area.html

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash command is:

  • /format: automatically format and lint the code

@yvonnefroehlich yvonnefroehlich added the documentation Improvements or additions to documentation label Apr 14, 2024
@yvonnefroehlich yvonnefroehlich added this to the 0.12.0 milestone Apr 14, 2024
@yvonnefroehlich yvonnefroehlich self-assigned this Apr 14, 2024
@yvonnefroehlich yvonnefroehlich changed the title Add gallery example showing how to fill the area between two curves WIP: Add gallery example showing how to fill the area between two curves Apr 14, 2024
@yvonnefroehlich
Copy link
Copy Markdown
Member Author

/format

@seisman
Copy link
Copy Markdown
Member

seisman commented Apr 9, 2026

Perhaps we should continue this tutorial, considering that it will definitely take some time to implement the Figure.fill_between method.

@yvonnefroehlich
Copy link
Copy Markdown
Member Author

Perhaps we should continue this tutorial, considering that it will definitely take some time to implement the Figure.fill_between method.

Sounds good. But need to finish PR #3169 to add an alias for -M first.

@yvonnefroehlich yvonnefroehlich changed the title WIP: Add gallery example showing how to fill the area between two curves Add gallery example showing how to fill the area between two curves Apr 10, 2026
@yvonnefroehlich yvonnefroehlich marked this pull request as ready for review April 10, 2026 09:42
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
yvonnefroehlich and others added 2 commits April 10, 2026 12:11
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
yvonnefroehlich and others added 2 commits April 10, 2026 12:14
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
@seisman seisman added this to the 0.19.0 milestone Apr 10, 2026
@yvonnefroehlich yvonnefroehlich added needs review This PR has higher priority and needs review. and removed needs review This PR has higher priority and needs review. labels Apr 10, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Sphinx-Gallery example demonstrating how to fill the area between two curves using the fill_between alias for GMT’s plot -M option, including variants with curve outlines and comparison against a constant y-level.

Changes:

  • Introduce a new gallery example showing Figure.plot(fill_between=...) with separate fills/legend labels for the two regions.
  • Add follow-up examples demonstrating drawing both curves and filling relative to a horizontal reference line.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,82 @@
"""
Fill area between curves
------------------------
possible to fill the area between two curves y1 and y2. Different fills (colors or
patterns) can be used for the areas y1 > y2 and y1 < y2. Optionally, the curves can
be drawn.
To plot an anomaly along a track use :meth:`pygmt.Figure.grdlandmask` and see the
# %%
# Fill the areas between the two curves using the ``fill_between`` parameter.
# Use the ``fill`` parameter and the modifier **+g** for ``fill_between`` to
# set different fills for areas with y1 > y2 and y2 < y1, respectively. Use


# %%
# Additionally to filling the areas, we can draw the curves. Use the ``pen``
Comment on lines +13 to +16
import numpy as np
import pandas as pd
import pygmt as gmt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants