Closed EJFielding closed 5 years ago
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct.
Thanks for posting, @EJFielding. Could you please provide the Python code you used to generate the above plot? I'm wondering if this is a figure width / portrait mode issue.
Edit: Whoops, I see that you mentioned the code that you're using above. Try setting a smaller figure width for the projection
flag and see what happens... maybe projection="M4i"
, for example.
Thanks for the quick reply. Yes, if I set the projection="M4i"
then I see more of the figure, but not quite all. I am a beginning Jupyter user, so I don't have any idea what controls the width of the figure. For some reason, I can only plot figures that are about 3 inches wide.
It is good that the saved file is the same, so "what you see is what you get".
it only plots the left half of the figure and chops off the top a little. This is the same for the Jupyter notebook and the saved png file.
@EJFielding Could you try following GMT commands in your terminal and check if the generated PNG file is correct?
gmt begin map png
gmt basemap -R-90/-70/0/20 -JM8i -B
gmt coast -W
gmt end
Could you also please provide your GMT version (gmt --version
) and gs version (gs --version
)?
I ran those GMT commands in the shell command line and I get the complete map.
fielding% gmt --version 6.0.0_2f22074_2019.03.09
gs --version 9.26
Could you please paste the output of following Python codes?
import pygmt
pygmt.print_clib_info()
From Jupyter notebook, I get this:
Loaded libgmt: binary dir: /opt/local/Library/Frameworks/Python.framework/Versions/3.6/Resources/Python.app/Contents/MacOS cores: 8 grid layout: rows library path: /Users/fielding/tools/gmt/lib/libgmt.dylib padding: 2 plugin dir: /Users/fielding/tools/gmt/lib/gmt/plugins share dir: /Users/fielding/tools/gmt/share version: 6.0.0
I use MacPorts to install Python 3.6, so I kept my pygmt installation in my home directory tree to avoid messing with the MacPorts files, in case that makes a difference.
It looks OK to me. I have no idea where the problem is. Let's wait for @leouieda.
@EJFielding this is interesting. From GenericMappingTools/gmt#497 it seems to be a problem with the plot units. Could you share your cmake config for building GMT?
Sure, I attach my config file.
:thinking: I don't see anything wrong with the setup. It doesn't seem to be a problem on the Python side. I can't reproduce the effect. Which version of ghostscript do you have?
I have gs --version 9.26
When you do
gmtdefaults -D | grep PROJ_LENGTH_UNIT
PROJ_LENGTH_UNIT = cm
it prints cm
or inch
? (Because the GMT 497 issue seems to be related to the use of inches)
I have this default when I do that on the command line:
PROJ_LENGTH_UNIT = cm
I am not sure how to check the defaults within the Jupyter notebook.
It should be the same since we're using the same GMT library that the command line program uses.
From the discussion in GenericMappingTools/gmt#497, do you have a gmt.conf
file in the current directory? The new GMT modern mode sets the PS_MEDIA
to a huge page and then crops the plot down when exporting it afterwards. If you're setting PS_MEDIA
and forcing it to be letter or A4, then this would be a problem.
Thanks! Yes, I have a gmt.conf in this directory because I was running GMT5. It has PS_MEDIA letter
in it.
I removed the gmt.conf
file and tried the 'first-figure.py
plot again and it shows the whole thing. Here is the saved PNG:
I think you can close this issue. Maybe it would help to put something in the documentation to remove any gmt.conf
left over from previous GMT5 runs.
Thanks, Eric! It's good to know. We're actually discussing a better solution that wouldn't require the user to take action at GenericMappingTools/gmt#497
I managed to buiild GMT from source (kind of like the old days when editing the configuration file and building source was the only way). I installed pygmt and got it to import in my Jupyter notebook. When I try to make a simple plot like the "first-figure" example, it only plots the left half of the figure and chops off the top a little. This is the same for the Jupyter notebook and the saved png file. Here is the example saved: