Skip to content

Commit 476bf4c

Browse files
DOC/Gallery example "Envelope": General improvements (#3625)
1 parent 7ec2a12 commit 476bf4c

File tree

1 file changed

+13
-23
lines changed

1 file changed

+13
-23
lines changed

examples/gallery/lines/envelope.py

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
Envelope
33
========
44
5-
The ``close`` parameter of the :meth:`pygmt.Figure.plot` method can be
6-
used to build a symmetrical or an asymmetrical envelope. The user can
7-
give either the deviations or the bounds in y-direction. For the first
8-
case append ``"+d"`` or ``"+D"`` and for the latter case ``"+b"``.
5+
The ``close`` parameter of the :meth:`pygmt.Figure.plot` method can be used to build a
6+
symmetrical or an asymmetrical envelope. The user can give either the deviations or the
7+
bounds in y-direction. For the first case append ``"+d"`` or ``"+D"`` and for the latter
8+
case ``"+b"``.
99
"""
1010

1111
# %%
1212
import pandas as pd
1313
import pygmt
1414

15-
# Define a pandas DataFrame with columns for x and y as well as the
16-
# lower and upper deviations
15+
# Define a pandas.DataFrame with columns for x and y as well as the lower and upper
16+
# deviations
1717
df_devi = pd.DataFrame(
1818
data={
1919
"x": [1, 3, 5, 7, 9],
@@ -23,7 +23,7 @@
2323
}
2424
)
2525

26-
# Define the same pandas DataFrame but with lower and upper bounds
26+
# Define the same pandas.DataFrame but with lower and upper bounds
2727
df_bound = pd.DataFrame(
2828
data={
2929
"x": [1, 3, 5, 7, 9],
@@ -34,7 +34,6 @@
3434
)
3535

3636

37-
# Create Figure instance
3837
fig = pygmt.Figure()
3938

4039
# -----------------------------------------------------------------------------
@@ -55,15 +54,10 @@
5554
)
5655

5756
# Plot the data points on top
58-
fig.plot(
59-
data=df_devi,
60-
style="c0.2c", # Use circles with a diameter of 0.2 centimeters
61-
pen="1p,gray30",
62-
fill="darkgray",
63-
)
57+
fig.plot(data=df_devi, style="c0.2c", pen="1p,gray30", fill="darkgray")
6458

65-
# Shift plot origin 11 centimeters in x direction
66-
fig.shift_origin(xshift="11c")
59+
# Shift plot origin by the figure width ("w") plus 1 centimeter in x direction
60+
fig.shift_origin(xshift="w+1c")
6761

6862
# -----------------------------------------------------------------------------
6963
# Middle
@@ -77,18 +71,15 @@
7771
fig.plot(
7872
data=df_devi,
7973
fill="gray@50",
80-
# Add an outline around the envelope
81-
# Here, a dashed pen ("+p") with 0.5-points thickness and
82-
# "gray30" color is used
74+
# Add an outline around the envelope. Here, a dashed pen ("+p") with 0.5-points
75+
# thickness and "gray30" color is used
8376
close="+D+p0.5p,gray30,dashed",
8477
pen="1p,gray30",
8578
)
8679

87-
# Plot the data points on top
8880
fig.plot(data=df_devi, style="c0.2c", pen="1p,gray30", fill="darkgray")
8981

90-
# Shift plot origin 11 centimeters in x-direction
91-
fig.shift_origin(xshift="11c")
82+
fig.shift_origin(xshift="w+1c")
9283

9384
# -----------------------------------------------------------------------------
9485
# Right
@@ -102,7 +93,6 @@
10293
# Plot an envelope based on the bounds ("+b")
10394
fig.plot(data=df_bound, close="+b+p0.5p,gray30,dashed", pen="1p,gray30")
10495

105-
# Plot the data points on top
10696
fig.plot(data=df_bound, style="c0.2c", pen="1p,gray30", fill="darkgray")
10797

10898
fig.show()

0 commit comments

Comments
 (0)