You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Easy task if you know some sphinx] Add example for setting map title #335
To do that, you'll need to know how to use the the frame (B) setting in the basemap function. Specifically, you might need to refer to the GMT docs on setting the B-option. This one line of code below (adapted from #325 (comment)) is part of what you need to do the trick:
fig.basemap(frame=["ag", "+tTitle"]
You can find out more about contributing in our CONTRIBUTING.md docs. Leave a comment below if you'd like to start working on this and feel free to ask for help! It's actually as much of a learning experience for us as it will be for you 😄
Stretch goals
In addition to setting a title, Find out how to set an x-axis label called "Longitude" and y-axis label called "Latitude"!
I noticed the same thing. Putting title-setting in the docs would be super helpful.
It's slightly tricky with escape-character-quotations... Not sure if you want to explain things like this in the tutorials, but you can set the title on the fly like this:
# my_variable is a string (ex: "shear stress")
title="+t\"Map of "+my_variable+" values\"";
fig.basemap(frame=["ag", title];
@weiji14 I'm struggling with the stretch goals of adding the axis labels. I thought it would be the same as setting the labels on the color bars, and the arguments would be x+lLongitude and y+lLatitude but that is not plotting any axis labels. I can't find anything in the PyGMT or GMT docs for the solution; any idea?
Since the rest of the tutorial is for geographic maps, do you think it's better to use a non-geographic map for this last part or just not include axis labels in this tutorial?
I don't have a good idea for this. Perhaps it's better to show labels for non-geographic maps and also explain why it doesn't work for geographic maps.
Currently struggling with adding the labels. I'm using: fig.basemap(region=[0, 10, 0, 20], projection="X4i/3i", frame=["x+lx-axis", "y+ly-axis"])
It is plotting the x-axis label on both the top and bottom and the y-axis label on the left and right side. Not seeing anything in the GMT docs to specify that it only print in one location; any ideas?
@weiji14@seisman Would needing to add the "WSne" argument be best explained that, by default, all axes are designated as primary axes and "WSne" is needed to make only the left and bottom axes primary?
Activity
weiji14 commentedon Nov 14, 2019
@Jessie42 will be working on this!
weiji14 commentedon Nov 14, 2019
https://www.gitpod.io/#/https://github.com/GenericMappingTools/pygmt
kmaterna commentedon Apr 16, 2020
I noticed the same thing. Putting title-setting in the docs would be super helpful.
It's slightly tricky with escape-character-quotations... Not sure if you want to explain things like this in the tutorials, but you can set the title on the fly like this:
willschlitzer commentedon Dec 7, 2020
I'll take on this issue.
willschlitzer commentedon Dec 8, 2020
@weiji14 I'm struggling with the stretch goals of adding the axis labels. I thought it would be the same as setting the labels on the color bars, and the arguments would be
x+lLongitudeandy+lLatitudebut that is not plotting any axis labels. I can't find anything in the PyGMT or GMT docs for the solution; any idea?seisman commentedon Dec 8, 2020
GMT doesn't allow adding labels to geographic maps. As for geographic maps, the X-axis is always longitude and the Y axis is always latitude.
willschlitzer commentedon Dec 8, 2020
Since the rest of the tutorial is for geographic maps, do you think it's better to use a non-geographic map for this last part or just not include axis labels in this tutorial?
seisman commentedon Dec 8, 2020
I don't have a good idea for this. Perhaps it's better to show labels for non-geographic maps and also explain why it doesn't work for geographic maps.
willschlitzer commentedon Dec 8, 2020
That's a good idea; I'll add it tomorrow
willschlitzer commentedon Dec 9, 2020
Currently struggling with adding the labels. I'm using:
fig.basemap(region=[0, 10, 0, 20], projection="X4i/3i", frame=["x+lx-axis", "y+ly-axis"])It is plotting the x-axis label on both the top and bottom and the y-axis label on the left and right side. Not seeing anything in the GMT docs to specify that it only print in one location; any ideas?
weiji14 commentedon Dec 9, 2020
Try with
frame=["WSne", "x+lx-axis", "y+ly-axis"].willschlitzer commentedon Dec 9, 2020
It worked! Thanks
willschlitzer commentedon Dec 9, 2020
@weiji14 @seisman Would needing to add the "WSne" argument be best explained that, by default, all axes are designated as primary axes and "WSne" is needed to make only the left and bottom axes primary?
seisman commentedon Dec 11, 2020
Closed by #720.