@@ -61,11 +61,11 @@ is equivalent to the following in modern mode::
6161 # Same thing but no redirecting and -R -J -O -K
6262 gmt grdgradient -Nt0.2 -A45 data.nc -Gintens.nc
6363 gmt makecpt -Cgeo -T-8000/2000 > t.cpt
64- gmt grdimage -Ct.cpt -Iintens.nc data.nc -JM6i -P
65- gmt pscoast -Rdata.nc -Dh -Baf -W0.75p
66- echo "Japan Trench" | gmt pstext -F+f32p+cTC -Dj0/0.2i -Gwhite
67- gmt psxy -W2p lines.txt
68- gmt psscale -DjBL+w3i/0.1i+h+o0.3i/0.4i -Ct.cpt -W0.001 -F+gwhite+p0.5p -Bxaf -By+l"km"
64+ gmt grdimage -Ct.cpt -Iintens.nc data.nc -JM6i
65+ gmt coast -Rdata.nc -Dh -Baf -W0.75p
66+ echo "Japan Trench" | gmt text -F+f32p+cTC -Dj0/0.2i -Gwhite
67+ gmt plot -W2p lines.txt
68+ gmt colorbar -DjBL+w3i/0.1i+h+o0.3i/0.4i -Ct.cpt -W0.001 -F+gwhite+p0.5p -Bxaf -By+l"km"
6969 # When a session ends, GMT will fetch the map it produced and convert it to
7070 # PDF automatically. The file will be named after the session "map.pdf"
7171 gmt end
@@ -89,7 +89,7 @@ later** and require the `new "modern" mode of GMT <http://gmt.soest.hawaii.edu/b
8989The ``modern `` mode removes the need for ``-O -K `` and explicitly redirecting
9090to a ``.ps `` file.
9191This all happens in the background.
92- A final call to ``gmt psconvert `` brings the plot out of hiding and finalizes
92+ A final call to ``gmt end `` brings the plot out of hiding and finalizes
9393the Postscript.
9494This mode is perfect for the Python interface, which would have to handle
9595generation of the Postscript file in the background anyway.
@@ -128,20 +128,22 @@ figure, just as a normal GMT script::
128128
129129 import gmt
130130
131+ fig = gmt.Figure()
131132 cpt = gmt.makecpt(C='cubhelix', T=[-4500, 4500])
132- gmt .grdimage(input='grid.nc', J='M6i', B='af', P=True, C=cpt)
133- gmt.psscale (C=cpt, D='jTC+w6i/0.2i+h+e+o0/1i', B='af')
134- gmt.psconvert(T='f', F=' my-figure' )
133+ fig .grdimage(input='grid.nc', J='M6i', B='af', P=True, C=cpt)
134+ fig.colorbar (C=cpt, D='jTC+w6i/0.2i+h+e+o0/1i', B='af')
135+ fig.savefig(" my-figure.pdf" )
135136
136137Arguments can also be passed as in the GMT command-line by using a single
137138string::
138139
139140 import gmt
140141
142+ fig = gmt.Figure()
141143 gmt.makecpt('-Ccubhelix -T-4500/4500', output='my.cpt')
142- gmt .grdimage('grid.nc -JM6i -Baf -P -Cmy.cpt')
143- gmt.psscale ('-Cmy.cpt -DjTC+w6i/0.2i+h+e+o0/1i -Baf')
144- gmt.psconvert('-Tf -Fmy- figure' )
144+ fig .grdimage('grid.nc -JM6i -Baf -P -Cmy.cpt')
145+ fig.colorbar ('-Cmy.cpt -DjTC+w6i/0.2i+h+e+o0/1i -Baf')
146+ fig.savefig("my- figure.pdf" )
145147
146148Notice that output that would be redirected to a file is specified using the
147149``output `` keyword argument.
@@ -156,8 +158,9 @@ netCDF file or generated in memory::
156158 data = xr.open_dataset('grid.nc')
157159
158160 cpt = gmt.makecpt(C='cubhelix', T='-4500/4500')
159- gmt.grdimage(input=data, J='M6i', B='af', P=True, C=cpt)
160- gmt.psconvert(T='f', F='my-figure')
161+ fig = gmt.Figure()
162+ fig.grdimage(input=data, J='M6i', B='af', P=True, C=cpt)
163+ fig.savefig('my-figure.pdf')
161164
162165Tabular data can be passed as numpy arrays::
163166
@@ -167,9 +170,10 @@ Tabular data can be passed as numpy arrays::
167170 data = np.loadtxt('data_file.csv')
168171
169172 cpt = gmt.makecpt(C="red,green,blue", T="0,70,300,10000")
170- gmt.pscoast(R='g', J='N180/10i', G='bisque', S='azure1', B='af', X='c')
171- gmt.psxy(input=data, S='ci', C=cpt, h='i1', i='2,1,3,4+s0.02')
172- gmt.psconvert(T='f', F='my-figure')
173+ fig = gmt.Figure()
174+ fig.coast(R='g', J='N180/10i', G='bisque', S='azure1', B='af', X='c')
175+ fig.plot(input=data, S='ci', C=cpt, h='i1', i='2,1,3,4+s0.02')
176+ fig.savefig('my-figure.pdf')
173177
174178
175179In the Jupyter notebook, we can preview the plot by calling ``gmt.show() ``,
@@ -181,8 +185,9 @@ which embeds the image in the notebook::
181185 data = np.loadtxt('data_file.csv')
182186
183187 cpt = gmt.makecpt(C="red,green,blue", T="0,70,300,10000")
184- gmt.pscoast(R='g', J='N180/10i', G='bisque', S='azure1', B='af', X='c')
185- gmt.psxy(input=data, S='ci', C=cpt, h='i1', i='2,1,3,4+s0.02')
188+ fig = gmt.Figure()
189+ fig.coast(R='g', J='N180/10i', G='bisque', S='azure1', B='af', X='c')
190+ fig.plot(input=data, S='ci', C=cpt, h='i1', i='2,1,3,4+s0.02')
186191 gmt.show()
187192
188193``gmt.show `` will call ``psconvert `` in the background to get a PNG image back
@@ -205,7 +210,7 @@ this::
205210
206211
207212 gmt/
208- c_api / # Package with low-level wrappers for the C API
213+ clib / # Package with low-level wrappers for the C API
209214 ...
210215 modules/ # Defines the functions corresponding to GMT modules
211216 ...
0 commit comments