-
Notifications
You must be signed in to change notification settings - Fork 225
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
pygmt does not display images using show() #366
Comments
I note that this does in fact work in a jupyter notebook, but not in a standard terminal session. |
In an IPython terminal, you need to call |
That appears to save the figure as a temporary file, and then opens it with an external application. Would it be possible to
What I would really like to do is have a simple way of choosing to plot something using either standard matplotlib or gmt, such as:
|
Hi @MarkWieczorek, I'm not sure if there's a way to put pygmt figures inside matplotlib (point 2), but in regard to a matplolib compatible syntax (point 1), @leouieda definitely put some thought before on how to make the display mechanisms better at #269. If it's subplots you're interested in, the modern mode in GMT 6 does have a subplot feature, but that's not wrapped yet. I actually have some local code to implement that but it'll take time to get into PyGMT properly. Could you describe in a bit more detail what you're trying to plot? If I'm reading this correctly, are you interested in showing the figure inline inside of an IPython terminal? |
What I would like to do is create a custom plotting method for use with pyshtools. The idea would be to take an instance of a grid and then do
The You seem to be saying that this is impossible, so the alternative would be to return a figure, and then manually specify to show it, like
|
Right, so you want to make a Could you point me to some sample code on what that |
@MarkWieczorek I started a branch for implementing #269 (PR coming soon) and here is what I have working:
So you could have Regarding inserting plots in matplotlib, the problem is that the figure would be a raster. We could get a PNG returned by PyGMT and insert that as matplotlib axis. The problem is that it looks bad when exporting the figure later on. This was my original idea for the display mechanism but I gave up on it at the time. The "best" way to do this would be to translate postscript to matplotlib's vector format but I doubt anyone would be willing to do it. I'm not even sure it's possible since GMT does a lot of coding in the postscript itself. If anyone is can find a way of inserting raster into matplotlib in a way that it looks good, I'd be happy to implement this in PyGMT. Mixing GMT and matplotlib in the same figure would be a dream! |
gmt version = 6.0.0 (macOS, installed via brew)
pygmt does not display newly created figures using
show()
.The text was updated successfully, but these errors were encountered: