-
Notifications
You must be signed in to change notification settings - Fork 214
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
How to set font size on scale bar? #3230
Comments
👋 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. |
Hello @Dani-Lindsay, The issue with the transparency is related to ghostscript. It is known that there are issues with transparency in GMT 6.4.0 when using gostscript 10.03.0. These issues are fixed in GMT 6.5.0. The different behaviour of the font size is related to the change from GMT 6.4.0 to 6.5.0. For details please see the GMT documentation at https://docs.generic-mapping-tools.org/dev/colorbar.html#description. Changing the font size locally can help here: import pygmt
size = 5
# (I)
fig = pygmt.Figure()
fig.basemap(region=[-size, size, -size, size], projection=f"X{size}c", frame=1)
fig.colorbar(cmap="batlow", position="jMC", frame=["x+lquantity", "y+lunit"])
fig.show()
# (II)
fig = pygmt.Figure()
fig.basemap(region=[-size, size, -size, size], projection=f"X{size}c", frame=1)
# local changes of GMT defaults via context manager
with pygmt.config(
FONT_ANNOT_PRIMARY="17p,blue",
FONT_ANNOT_SECONDARY="15p,darkgreen",
FONT_LABEL="20p,orange",
):
fig.colorbar(cmap="batlow", position="jMC", frame=["x+lquantity", "y+lunit"])
fig.show()
duplicate to |
Sorry, just re-read the link above. So this is a feature of "modern mode" and the fonts are automatically scaled and overwrite the pygmt.config(). Makes sense! Thanks. Here my original message still... ... Thanks for your quick response @yvonnefroehlich ! This does look like the issue in #3041 linked above. I just played around with this a little bit. Code below for this figure. As you can see using pygmt.config() at the beginning does set font for the boarder but not for the color scale [left]. The local setting does work that you did suggestion above [right]. It's odd that the scale bar font specify locally at 20p is pretty much the same size as the text at 10p in the centre of the figure. Are you able to recreate this error?
|
Hi all,
I was having trouble with using transparency and solved this by just reinstalling pygmt in a new conda environment but now the font on my scale bars has gone strange... What config parameter controls the font size on the color bars? I tried to set all the different font configs to override this but didn't worked.
Old environment...
New environment...
Code to make these plots
The text was updated successfully, but these errors were encountered: