Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fig.show() not work #1159

Closed
zengxianghang opened this issue Apr 2, 2021 · 3 comments
Closed

fig.show() not work #1159

zengxianghang opened this issue Apr 2, 2021 · 3 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@zengxianghang
Copy link

zengxianghang commented Apr 2, 2021

Description of the problem
After the following code runs, the figure cannot be displayed automatically.

Full code that generated the error

import pygmt

pygmt.show_versions()
fig = pygmt.Figure()
fig.basemap(region=[-90, -70, 0, 20], projection="M15c", frame=True)
fig.coast(shorelines=True)
fig.show()

Full error message

PASTE ERROR MESSAGE HERE

System information

Please paste the output of python -c "import pygmt; pygmt.show_versions()":

PyGMT information:
  version: v0.3.1
System information:
  python: 3.9.1 (default, Dec 11 2020, 06:28:49)  [Clang 10.0.0 ]
  executable: /Users/zengxianghang/opt/miniconda3/bin/python
  machine: macOS-10.16-x86_64-i386-64bit
Dependency information:
  numpy: 1.20.2
  pandas: 1.2.3
  xarray: 0.17.0
  netCDF4: 1.5.6
  packaging: 20.9
  ghostscript: 9.53.3
  gmt: 6.1.1
GMT library information:
  binary dir: /Users/zengxianghang/opt/miniconda3/bin
  cores: 8
  grid layout: rows
  library path: /Users/zengxianghang/opt/miniconda3/lib/libgmt.dylib
  padding: 2
  plugin dir: /Users/zengxianghang/opt/miniconda3/lib/gmt/plugins
  share dir: /Users/zengxianghang/opt/miniconda3/share/gmt
  version: 6.1.1```
@zengxianghang zengxianghang added the bug Something isn't working label Apr 2, 2021
@seisman
Copy link
Member

seisman commented Apr 2, 2021

If you're running a python script or running the codes in a Python interpreter, you need to use fig.show(method="external").

Duplicate of #366, and should be fixed in #529.

@seisman seisman added the duplicate This issue or pull request already exists label Apr 2, 2021
@Khalilsqu
Copy link

I still get an error!

import pygmt

fig = pygmt.Figure()

fig.basemap(region=[-90,-70,0,20], projection="M8i", frame=True)
fig.coast(shorelines=True)

fig.show(method="external")

image

@seisman
Copy link
Member

seisman commented Apr 16, 2022

I still get an error!

import pygmt

fig = pygmt.Figure()

fig.basemap(region=[-90,-70,0,20], projection="M8i", frame=True)
fig.coast(shorelines=True)

fig.show(method="external")

image

Maybe fig.show(method="external", waiting=1.0) works for you. See https://www.pygmt.org/dev/api/generated/pygmt.Figure.show.html for detailed explanations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants