|
14 | 14 | To save the figure, use ``fig.savefig("figname.pdf")`` where ``"figname.pdf"``
|
15 | 15 | is the desired name and file extension for the saved figure.
|
16 | 16 | """
|
17 |
| -# sphinx_gallery_thumbnail_number = 7 |
| 17 | +# sphinx_gallery_thumbnail_number = 4 |
18 | 18 |
|
19 | 19 | import pygmt
|
20 | 20 |
|
21 | 21 | # Load sample earth relief data
|
22 |
| -grid = pygmt.datasets.load_earth_relief(resolution="05m", region=[-108, -103, 35, 40]) |
| 22 | +grid = pygmt.datasets.load_earth_relief(resolution="10m", region=[-108, -103, 35, 40]) |
23 | 23 |
|
24 | 24 | ########################################################################################
|
25 | 25 | # The :meth:`pygmt.Figure.grdview` method takes the ``grid`` input.
|
|
45 | 45 |
|
46 | 46 | ########################################################################################
|
47 | 47 | # The grid surface type can be set with the ``surftype`` parameter.
|
48 |
| - |
49 |
| -fig = pygmt.Figure() |
50 |
| -fig.grdview( |
51 |
| - grid=grid, |
52 |
| - perspective=[130, 30], |
53 |
| - frame=["xa", "ya", "WSnE"], |
54 |
| - projection="M15c", |
55 |
| - zsize="1.5c", |
56 |
| - # Set the surftype to "surface" |
57 |
| - surftype="s", |
58 |
| -) |
59 |
| -fig.show() |
60 |
| - |
61 |
| -######################################################################################## |
62 | 48 | # The default CPT is *turbo* and can be customized with the ``cmap`` parameter.
|
63 | 49 |
|
64 | 50 | fig = pygmt.Figure()
|
|
68 | 54 | frame=["xa", "yaf", "WSnE"],
|
69 | 55 | projection="M15c",
|
70 | 56 | zsize="1.5c",
|
| 57 | + # Set the surftype to "surface" |
71 | 58 | surftype="s",
|
72 | 59 | # Set the CPT to "geo"
|
73 | 60 | cmap="geo",
|
|
94 | 81 |
|
95 | 82 | ########################################################################################
|
96 | 83 | # The ``perspective`` azimuth can be changed to set the direction that is "up"
|
97 |
| -# in the figure. |
| 84 | +# in the figure. The ``contourpen`` parameter sets the pen used to draw contour lines |
| 85 | +# on the surface. :meth:`pygmt.Figure.colorbar` can be used to add a color bar to the |
| 86 | +# figure. The ``cmap`` parameter does not need to be passed again. To keep the color |
| 87 | +# bar's alignment similar to the figure, use ``True`` as the ``perspective`` parameter. |
98 | 88 |
|
99 | 89 | fig = pygmt.Figure()
|
100 | 90 | fig.grdview(
|
101 | 91 | grid=grid,
|
102 | 92 | # Set the azimuth to -130 (230) degrees and the elevation to 30 degrees
|
103 | 93 | perspective=[-130, 30],
|
104 |
| - frame=["xa", "yaf", "WSnE"], |
105 |
| - projection="M15c", |
106 |
| - zsize="1.5c", |
107 |
| - surftype="s", |
108 |
| - cmap="geo", |
109 |
| - plane="1000+ggrey", |
110 |
| -) |
111 |
| -fig.show() |
112 |
| - |
113 |
| -######################################################################################## |
114 |
| -# The ``contourpen`` parameter sets the pen used to draw contour lines on the surface. |
115 |
| - |
116 |
| -fig = pygmt.Figure() |
117 |
| -fig.grdview( |
118 |
| - grid=grid, |
119 |
| - perspective=[-130, 30], |
120 |
| - frame=["xaf", "yaf", "WSnE"], |
121 |
| - projection="M15c", |
122 |
| - zsize="1.5c", |
123 |
| - surftype="s", |
124 |
| - cmap="geo", |
125 |
| - plane="1000+ggrey", |
126 |
| - # Set the contour pen thickness to "0.5p" |
127 |
| - contourpen="0.5p", |
128 |
| -) |
129 |
| -fig.show() |
130 |
| - |
131 |
| -######################################################################################## |
132 |
| -# :meth:`pygmt.Figure.colorbar` can be used to add a color bar to the figure. The |
133 |
| -# ``cmap`` argument does not need to be passed again. To keep the color bar's alignment |
134 |
| -# similar to the figure, use ``True`` as the ``perspective`` argument. |
135 |
| - |
136 |
| -fig = pygmt.Figure() |
137 |
| -fig.grdview( |
138 |
| - grid=grid, |
139 |
| - perspective=[-130, 30], |
140 | 94 | frame=["xaf", "yaf", "WSnE"],
|
141 | 95 | projection="M15c",
|
142 | 96 | zsize="1.5c",
|
143 | 97 | surftype="s",
|
144 | 98 | cmap="geo",
|
145 | 99 | plane="1000+ggrey",
|
| 100 | + # Set the contour pen thickness to "0.1p" |
146 | 101 | contourpen="0.1p",
|
147 | 102 | )
|
148 | 103 | fig.colorbar(perspective=True, frame=["a500", "x+lElevation", "y+lm"])
|
|
0 commit comments