GenericMappingTools/GMT.jl

showfig not displaying figure in Pluto notebook (GMT@v1.20.0, Pluto@v0.20.3 Julia@v1.11.1)

CyprienBosserelle opened this issue · 5 comments

Hi Joaquim,
My fresh install of GMT does work well inside the REPL displaying images properly when the window pops up but inside a Pluto notebook it shows the images i made last from the terminal and not the one I'm trying to make inside the notebook.

I tortured the showfig function a little and got it to work but this is probably more of a workaround than a solution:
From how I understand the problem:
Showfig is expecting "Pluto, the image is already in a raster format by a previous call to 'gmt end'" but in my case the figure is actually a (unclosed) .ps file. I'm pretty sure of that because when I make these changes.

image

It all works as expected.
Now I'm not sure this is really how it is meant to work (i.e. is this a gmt end problem upstream?) or if it breaks something else so I haven't bothered making a pull request from that.

I hope this helps and thanks for the awesome work you have been doing!
Cheers,
Cyp

This one will take me more time to check. I don't use Pluto for a long time (because it annoys me that I have to do begin end for more than one command. They look too much to gmt begin gmt end. But Jupyter notebooks work fine, as long as I start with (don't remember if this is documented or not)

# Tell GMT to display the images in VSCode
ENV["DISPLAY_IN_VSC"] = "y";

I don't give up easily but this Pluto shit is getting on my nerves. I committed a patch with spirit of your example but nothing changed. It creates a non-clodsed .ps plus a .png with what should have been the closing PS code. I've tried all I could think of it majestically ignores me. Nothing that I try lets me debug it. No printf's, no errors if I remove functions. Just nothing. I'm now suspecting that it is using the 1.20 release instead the developing version that I work on.

Almost for sure is it. After adding Pkg.develop("GMT") to my test notebook the changes that I committed work fine. I'll tag a new version soon but there are things (3D stuff) that I would like to have working before that.

Released a new version (1.21.0) and this seems to be solved. Please confirm.

Thanks Joaquim,
I tried the new version this morning and It looks like it resolved the issue on my end too.
Cheers
C