Just a quick note.
I’ve used GMT for many years but I’m completely new to pygmt.
Just installed today and started playing with it.
The first thing I notice following the readthedocs example:
fig = pygmt.Figure()
fig.basemap(region=[-90, -70, 0, 20], projection=“M8i”, frame=True)
fig.coast(shorelines=True)
fig.show()
is that fig.show() does not open the plot.
I tested a simple example in matplotlib (in same conda env) and fig.show() works as expected.
For pygmt, I had to do:
fig.show(method=‘external’)
and this works to open a pdf. However, the docs are misleading:
https://www.pygmt.org/latest/api/generated/pygmt.Figure.show.html#pygmt.Figure.show
If
method='external'
, makes PDF preview instead and opens it in the default viewer for your operating system (falls back to the default web browser). Note that the external viewer does not block the current process, so this won’t work in a script.
I’m running this in a script and it works just fine.