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
gmt basemap polar stereographic projection, 90 degree latitude tick is funny #8828
I am making a map using a polar stereograpic projection, and wanted to get a 90 S tick and annotation on one axis. Could not get this working, and discovered that the 90 degree latitude tick is actually present on the inside.
I would like to be able to add 90 S annotation (that I did externally) and a tick, but could not get the tick. Some code:
gmt basemap -R-90/90/-90/-60 -JS0/-90/10c -BWsEN -Bxaf -Byaf --MAP_FRAME_TYPE=plain -png test
the plot, see what the tick at the pole is doing -BWSEN produces the same result:
Both ticks are actually present, W and E, gmt basemap -R-90/45/-90/-60 -JS0/-90/10c -BWSEN -Bxaf -Byaf --MAP_FRAME_TYPE=plain -png test:
I wanted the 90 S tick present on the E axis looking outside (not inside), and annotated (at least the tick present so I could manually create annotation). Bottom axis (apparently W in this specific arrangement of plot axes) tics were not needed as I used bottom axis to plot annotations in projected coordinates. S axis is degraded to the pole position, practically does not exist as I could understand.
See the 90 S tick on the plot below. The 90 S annotation was added externally, and the tick also added externally using the frame in projected coordinates with a tick step exceeding the map size so only one tick is plotted. This trick however does not work if the right axis is not vertical e.g. in case region is -R-90/15/-90/-60 -Js0/-90/-65/$scale
So the only thing left currently is something like drawing that tick manually using the MAP_TICK_LENGTH_PRIMARY and MAP_TICK_PEN_PRIMARY? I wonder how approximately?
I can calculate tick direction angle cause I set the stereographic projection's E and W boundaries. Is there something like a vector with no arrow that can be plotted from the point (0,-90) at the given angle having length of MAP_TICK_LENGTH_PRIMARY using pen set by MAP_TICK_PEN_PRIMARY?
I don't understand how to make a small custom axis exactly positioned where I need it and at the needed angle. E.g. projection is -R-90/10/-90/-60 -Js0/-90/-65/$scale so the right axis is a e.g. a 10 degree slope. I could not do this using projected coords as those are rectangular. And with -Js 90 degree the tick is turned inside and the label is not plotted.
I mean getting a 90 S tick there (plot updated, tick added using workaround shown below):
I thought more on a small Cartesian custom axis to avoid the 90 non-ploting issue. But positioning and orientation may be a problem though.
Sorry, have to leave now.
workaround (the plot above was updated just in case)
SCALE=1:25000000
FONT=10p,Helvetica
THETA=10 # 10 degrees
#Y 90 S tick, missing on the basemap frame/axes ticks
echo 0 -90 -$THETA 4p | gmt plot -R-90/${THETA}/-90/-60 -Js0/-90/-65/${SCALE} -Sv10.0+p -Wthinner,black -N
# vertical Y axis latitude annotations
Y_OFF=$(gmt math -Q $THETA -1 MUL SIND 20 MUL =)
X_OFF=$(gmt math -Q $THETA COSD 20 MUL =)
gmt text -F+jMC+f${FONT} -D${X_OFF}p/${Y_OFF}p -N <<-EOF
${THETA} -60 [email protected]
${THETA} -75 [email protected]
${THETA} -90 [email protected]
EOF
BTW read the docs but could never understand what that 1.0 in -Sv1.0+p is doing. Tried to set it to a different value like 10.0, made no visible difference on the plot. If I skipped it like -Sv+p, no vector was plotted and error message shown:
plot [WARNING]: Mismatch between actual (4) and expected (5) fields near line 1 in file <Standard Input>
UPD 1.0 in -Sv1.0+p is the size of the vector arrow head. Makes no difference once one does not need the head.
You are absolutely right, the docs clearly state that "size" is the length of the vector head. I just somehow missed it while reading the docs. Anyway I did not need vector head, just a straight line to draw my axis tick.
The docs however do not mention that 1.0 is the maximum size. Below is what's in the web docs for -Sv
-Svsize[+vecmodifiers]
vector. The direction (in degrees counter-clockwise from horizontal)
and length must be found after the location [and value] columns, and
size, if not specified on the command-line, should be present as well,
pushing the other items to later columns. The size is the length of the
vector head. Vector stem width is set by [-W](https://docs.generic-mapping-tools.org/6.6/plot.html#w),
with head outline pen width defaulting to half of stem pen width.
See [Vector Attributes](https://docs.generic-mapping-tools.org/6.6/plot.html#vector-attributes)
for specifying this and other attributes.
Activity
joa-quim commentedon Nov 11, 2025
It looks that when it reaches the 90S the tick immediately jumps to the perpendicular to the other side. Better explained by figs.
mkononets commentedon Nov 11, 2025
So the only thing left currently is something like drawing that tick manually using the MAP_TICK_LENGTH_PRIMARY and MAP_TICK_PEN_PRIMARY? I wonder how approximately?
I can calculate tick direction angle cause I set the stereographic projection's E and W boundaries. Is there something like a vector with no arrow that can be plotted from the point (0,-90) at the given angle having length of MAP_TICK_LENGTH_PRIMARY using pen set by MAP_TICK_PEN_PRIMARY?
joa-quim commentedon Nov 11, 2025
Maybe a small custom axis that covers only that bit?
mkononets commentedon Nov 11, 2025
I don't understand how to make a small custom axis exactly positioned where I need it and at the needed angle. E.g. projection is
-R-90/10/-90/-60 -Js0/-90/-65/$scaleso the right axis is a e.g. a 10 degree slope. I could not do this using projected coords as those are rectangular. And with-Js90 degree the tick is turned inside and the label is not plotted.I mean getting a 90 S tick there (plot updated, tick added using workaround shown below):
joa-quim commentedon Nov 11, 2025
I thought more on a small Cartesian custom axis to avoid the 90 non-ploting issue. But positioning and orientation may be a problem though.
Sorry, have to leave now.
mkononets commentedon Nov 11, 2025
Sure, thanks for answering!
mkononets commentedon Nov 11, 2025
workaround (the plot above was updated just in case)
BTW read the docs but could never understand what that
1.0in-Sv1.0+pis doing. Tried to set it to a different value like 10.0, made no visible difference on the plot. If I skipped it like-Sv+p, no vector was plotted and error message shown:UPD
1.0in-Sv1.0+pis the size of the vector arrow head. Makes no difference once one does not need the head.joa-quim commentedon Nov 12, 2025
Did not check the docs but I think it's controling the shape of the vector head. 1.0 is maximum. Try 0.5 to see if it makes a difference.
mkononets commentedon Nov 12, 2025
You are absolutely right, the docs clearly state that "size" is the length of the vector head. I just somehow missed it while reading the docs. Anyway I did not need vector head, just a straight line to draw my axis tick.
The docs however do not mention that 1.0 is the maximum size. Below is what's in the web docs for
-Svmkononets commentedon Nov 13, 2025
There's an excellent section in the Technical reference:
The Drawing of Vectors
Would be excellent if it is cited in
gmt plotdocumentation, section about drawing vectorsjoa-quim commentedon Nov 18, 2025
PR #8831 created.