Skip to content

Commit 3661b61

Browse files
authored
DOC/Gallery example "3-D scatter plots": Migrate frame settings to the new Frame/Axis syntax (#4502)
1 parent 9e8bfdf commit 3661b61

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

examples/gallery/3d_plots/scatter3d.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@
99
parameter has to include the :math:`x`, :math:`y`, :math:`z` axis limits in the
1010
form of (xmin, xmax, ymin, ymax, zmin, zmax), which can be done automatically
1111
using :func:`pygmt.info`. To plot the z-axis frame, set ``frame`` as a
12-
minimum to something like ``frame=["WsNeZ", "zaf"]``. Use ``perspective`` to
12+
minimum to something like ``Frame(axes="WsNeZ", zaxis=Axis(annot=True, tick=True))``.
13+
Use ``perspective`` to
1314
control the azimuth and elevation angle of the view, and ``zscale`` to adjust
1415
the vertical exaggeration factor.
1516
"""
1617

1718
# %%
1819
import pandas as pd
1920
import pygmt
21+
from pygmt.params import Axis, Frame
2022

2123
# Load sample iris data
2224
df = pd.read_csv("https://github.com/mwaskom/seaborn-data/raw/master/iris.csv")
@@ -80,12 +82,13 @@
8082
# Set map dimensions (xmin, xmax, ymin, ymax, zmin, zmax)
8183
region=region,
8284
# Set frame parameters
83-
frame=[
84-
"WsNeZ3+tIris flower data set", # z axis label positioned on 3rd corner, add title
85-
"xafg+lPetal Width (cm)",
86-
"yafg+lSepal Length (cm)",
87-
"zafg+lPetal Length (cm)",
88-
],
85+
frame=Frame(
86+
axes="WsNeZ3", # z axis label positioned on 3rd corner
87+
title="Iris flower data set",
88+
xaxis=Axis(annot=True, tick=True, grid=True, label="Petal Width (cm)"),
89+
yaxis=Axis(annot=True, tick=True, grid=True, label="Sepal Length (cm)"),
90+
zaxis=Axis(annot=True, tick=True, grid=True, label="Petal Length (cm)"),
91+
),
8992
# Set perspective to azimuth NorthWest (315°), at elevation 25°
9093
perspective=[315, 25],
9194
# Vertical exaggeration factor

0 commit comments

Comments
 (0)