-
Notifications
You must be signed in to change notification settings - Fork 229
Closed
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationgood first issueGood for newcomersGood for newcomersscipy-sprintThings to work on during the SciPy sprint!Things to work on during the SciPy sprint!
Milestone
Description
Description of the problem
We need to update the documentation for the color
parameter in plot and plot3d because color
can also be 1d array
(originally posted in #1065 (comment)).
See the description of the color
parameter of plot:
color (str) – Select color or pattern for filling of symbols or polygons. Default is no fill.
See the description of the color
parameter of plot3d:
color (str) – Select color or pattern for filling of symbols or polygons. Default is no fill.
However, color
can also be a 1d array just like the sizes
parameter when we use x
/y
parameters for in the plot
and plot3d
methods. See the last example in Plotting data points. We can set color=data.depth_km
and data.depth_km
is a 1d array.
import pygmt
data = pygmt.datasets.load_japan_quakes()
region = [
data.longitude.min() - 1,
data.longitude.max() + 1,
data.latitude.min() - 1,
data.latitude.max() + 1,
]
print(region)
print(data.head())
fig = pygmt.Figure()
fig.basemap(region=region, projection="M15c", frame=True)
fig.coast(land="black", water="skyblue")
pygmt.makecpt(cmap="viridis", series=[data.depth_km.min(), data.depth_km.max()])
fig.plot(
x=data.longitude,
y=data.latitude,
sizes=0.02 * 2 ** data.magnitude,
color=data.depth_km,
cmap=True,
style="cc",
pen="black",
)
fig.colorbar(frame='af+l"Depth (km)"')
fig.show()
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationgood first issueGood for newcomersGood for newcomersscipy-sprintThings to work on during the SciPy sprint!Things to work on during the SciPy sprint!