Is there a standard way how to set the default parameters like FONT_ANNOT_PRIMARY etc. using PyGMT? I read about some suggestions regarding that topic on GitHub but currently I’m not sure how to set the different parameters.
Not at the moment. There has been some work in progress code at https://github.com/GenericMappingTools/pygmt/pull/293 but it has not been merged into master yet. Are you trying to just change the font sizes/colours?
Good to know Yes my main problem was to change the fontsize of the colorbar and the map frame annotations. Does any workaround exist for this issue at the moment?
Not exactly the best way, but I usually just change the scale of the map projection (e.g. from projection="x1:30000"
to projection="x1:60000"
).
I use this workaround to call gmtset
directly.
import pygmt
with pygmt.clib.Session() as session:
session.call_module('gmtset', 'FONT 11p')
session.call_module('gmtset', 'MAP_FRAME_TYPE fancy')
Thanks for your answers, the latter one works fine for me until the “offical” way how to do it will be implemented
FYI, https://github.com/GenericMappingTools/pygmt/pull/293 has been merged into master, so you can now do the following after running pip install https://github.com/GenericMappingTools/pygmt/archive/master.zip
:
pygmt.config(PARAMETER=value) # Global
# Locally set a value that will revert back to the default
with pygmt.config(PROJ_ELLIPSOID=value):
...
Awesome. I’m not seeing it documented on www.pygmt.org yet — docs build issue?
Also, if you have an existing install of PyGMT and you’re like me and are confused why
pip install https://github.com/GenericMappingTools/pygmt/archive/master.zip
doesn’t actually grab the newest code, try running
pip uninstall pygmt
first.
Something’s been acting up with our Travis CI, I’ll take a look! ~~In the meantime, you can try the temporary link at https://pygmt-git-gmtset.gmt.now.sh.~~ Edit: Documentation on pygmt.org now refreshed with Fix Github Pages deployment from Travis by weiji14 · Pull Request #410 · GenericMappingTools/pygmt · GitHub.
Great to see it’s finally implemented. Thanks!