Skip to content

Commit df1ab56

Browse files
committed
Merge branch 'master' into data_version_control
2 parents e30c708 + 346cc4d commit df1ab56

File tree

4 files changed

+35
-17
lines changed

4 files changed

+35
-17
lines changed

.github/workflows/ci_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676

7777
# Download cached remote files (artifacts) from GitHub
7878
- name: Download remote data from GitHub
79-
uses: dawidd6/action-download-artifact@v2.12.0
79+
uses: dawidd6/action-download-artifact@v2.13.0
8080
with:
8181
workflow: cache_data.yaml
8282
workflow_conclusion: success

.github/workflows/ci_tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292

9393
# Download cached remote files (artifacts) from GitHub
9494
- name: Download remote data from GitHub
95-
uses: dawidd6/action-download-artifact@v2.12.0
95+
uses: dawidd6/action-download-artifact@v2.13.0
9696
with:
9797
workflow: cache_data.yaml
9898
workflow_conclusion: success
@@ -135,7 +135,7 @@ jobs:
135135

136136
# Upload coverage to Codecov
137137
- name: Upload coverage to Codecov
138-
uses: codecov/codecov-action@v1.2.1
138+
uses: codecov/codecov-action@v1.2.2
139139
with:
140140
file: ./coverage.xml # optional
141141
env_vars: OS,PYTHON

.github/workflows/ci_tests_dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797

9898
# Download cached remote files (artifacts) from GitHub
9999
- name: Download remote data from GitHub
100-
uses: dawidd6/action-download-artifact@v2.12.0
100+
uses: dawidd6/action-download-artifact@v2.13.0
101101
with:
102102
workflow: cache_data.yaml
103103
workflow_conclusion: success

examples/gallery/3d_plots/scatter3d.py

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
The :meth:`pygmt.Figure.plot3d` method can be used to plot symbols in 3D.
66
In the example below, we show how the
77
`Iris flower dataset <https://en.wikipedia.org/wiki/Iris_flower_data_set>`__
8-
can be visualized using a perspective 3-dimensional plot. The ``region``
8+
can be visualized using a perspective 3D plot. The ``region``
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 :meth:`pygmt.info`. To plot the z-axis frame, set ``frame`` as a
@@ -19,35 +19,53 @@
1919

2020
# Load sample iris data, and convert 'species' column to categorical dtype
2121
df = pd.read_csv("https://github.com/mwaskom/seaborn-data/raw/master/iris.csv")
22-
df["species"] = df.species.astype(dtype="category")
22+
df.species = df.species.astype(dtype="category")
2323

2424
# Use pygmt.info to get region bounds (xmin, xmax, ymin, ymax, zmin, zmax)
25-
# The below example will return a numpy array like [0., 3., 4., 8., 1., 7.]
25+
# The below example will return a numpy array like [0.0, 3.0, 4.0, 8.0, 1.0, 7.0]
2626
region = pygmt.info(
2727
table=df[["petal_width", "sepal_length", "petal_length"]], # x, y, z columns
28-
per_column=True, # report output as a numpy array
29-
spacing="1/2/0.5", # rounds x, y and z intervals by 1, 2 and 0.5 respectively
28+
per_column=True, # report the min/max values per column as a numpy array
29+
# round the min/max values of the first three columns to the nearest multiple
30+
# of 1, 2 and 0.5, respectively
31+
spacing=(1, 2, 0.5),
3032
)
3133

32-
# Make our 3D scatter plot, coloring each of the 3 species differently
34+
# Make a 3D scatter plot, coloring each of the 3 species differently
3335
fig = pygmt.Figure()
36+
37+
# Define a colormap to be used for three categories, define the range of the
38+
# new discrete CPT using series=(lowest_value, highest_value, interval),
39+
# use color_model="+c" to write the discrete color palette "cubhelix" in
40+
# categorical format
3441
pygmt.makecpt(cmap="cubhelix", color_model="+c", series=(0, 3, 1))
42+
3543
fig.plot3d(
44+
# Use petal width, sepal length and petal length as x, y and z data input,
45+
# respectively
3646
x=df.petal_width,
3747
y=df.sepal_length,
3848
z=df.petal_length,
39-
sizes=0.1 * df.sepal_width, # Vary each symbol size according to a data column
40-
color=df.species.cat.codes.astype(int), # Points colored by categorical number code
41-
cmap=True, # Use colormap created by makecpt
42-
region=region, # (xmin, xmax, ymin, ymax, zmin, zmax)
49+
# Vary each symbol size according to another feature (sepal width, scaled by 0.1)
50+
sizes=0.1 * df.sepal_width,
51+
# Use 3D cubes ("u") as symbols, with size in centimeter units ("c")
52+
style="uc",
53+
# Points colored by categorical number code
54+
color=df.species.cat.codes.astype(int),
55+
# Use colormap created by makecpt
56+
cmap=True,
57+
# Set map dimensions (xmin, xmax, ymin, ymax, zmin, zmax)
58+
region=region,
59+
# Set frame parameters
4360
frame=[
4461
"WsNeZ3", # z axis label positioned on 3rd corner
4562
'xafg+l"Petal Width"',
4663
'yafg+l"Sepal Length"',
4764
'zafg+l"Petal Length"',
4865
],
49-
style="uc", # 3D cUbe, with size in centimeter units
50-
perspective=[315, 25], # Azimuth NorthWest (315°), at elevation 25°
51-
zscale=1.5, # Vertical exaggeration factor
66+
# Set perspective to azimuth NorthWest (315°), at elevation 25°
67+
perspective=[315, 25],
68+
# Vertical exaggeration factor
69+
zscale=1.5,
5270
)
5371
fig.show()

0 commit comments

Comments
 (0)