-
Notifications
You must be signed in to change notification settings - Fork 226
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
changing map annotation font size #733
Comments
Setting |
Here is an example. Changing the value from 6 to e.g., does not affect the font size
|
OK. I can reproduce your issue. Will see why it doesn't work as expected. Here is a workaround:
|
ah ok, so when issued after creating the figure instance it will work.
Thanks!
…On Mon, Dec 14, 2020 at 1:13 PM Dongdong Tian ***@***.***> wrote:
OK. I can reproduce your issue. Will see why it doesn't work as expected.
Here is a workaround:
import pygmt
projection = "A-95/42/4i"
region = "-119/22/-50/50r"
fig = pygmt.Figure()
pygmt.config(FONT_ANNOT="6p")
fig.basemap(
region=region,
projection=projection,
frame=True,
)
fig.show()
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#733 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABWSVAVQF7SSMHINX2NJ55LSUZIVBANCNFSM4U3B6IIQ>
.
--
Ulrich G. Wortmann
https://www.es.utoronto.ca/people/faculty/wortmann-ulrich/
Dept. of Earth Sciences Fax : 416 978 3938
University of Toronto Phone: 416 978 7084
22 Ursula Franklin Street, Toronto, ON, Canada M5S 3B1
|
Here is the step to reproduce the issue and understand why it doesn't work as expected. We first need to start a jupyter notebook, and run the following script. import pygmt
pygmt.config(FONT_ANNOT="20p")
projection = "A-95/42/4i"
region = "-119/22/-50/50r"
fig = pygmt.Figure()
fig.basemap(
region=region,
projection=projection,
frame=True,
)
fig.show()
Then, in the same jupyter notebook, we can change the annotation font size We can rewrite the above processes into a single script, like below: # "import pygmt" start a new session
import pygmt
# it changes GMT's global settings
pygmt.config(FONT_ANNOT="20p")
projection = "A-95/42/4i"
region = "-119/22/-50/50r"
fig = pygmt.Figure()
# the basemap has an annotation font size of 20p, as determined by the global FONT_ANNOT setting
fig.basemap(
region=region,
projection=projection,
frame=True,
)
fig.show()
# here, "import pygmt" doesn't start a new session
import pygmt
# here, "pygmt.config()" changes the **local** settings of the **previous** figure, so it doesn't affect the next figure
pygmt.config(FONT_ANNOT="6p")
projection = "A-95/42/4i"
region = "-119/22/-50/50r"
fig = pygmt.Figure()
# the basemap still has an annotation font size of 20p, as determined by the global FONT_ANNOT setting
fig.basemap(
region=region,
projection=projection,
frame=True,
)
fig.show() |
My reading of this issue is that it is a problem related to having one GMT session open all the time in PyGMT (c.f. #867). Either we:
This is needed to ensure that one figure session doesn't pollute the configurations of subsequent figures. |
Or we could document the behavior of |
Description of the problem
Setting
appears to have no effect and setting it directly like this
results in a parsing error.
I may not see the forest for trees here... so any pointers are much appreciated
This is
Full code that generated the error
Full error message
System information
Please paste the output of
python -c "import pygmt; pygmt.show_versions()"
:The text was updated successfully, but these errors were encountered: