Psscale and map scale position/color

Hello

I am plotting a map in which I am trying to plot the colobar vertically on the left side of the map. It is plotting normal; however, the annotations + label is shown on the right side of the colobar, overlapping the map. I could move it to another point, but I would like to know if there is a way on GMT to change the annotation’s position and label in colorbar. Here is my code:

gmt psscale -D-1/2.9/4.4/0.3v -Cillum.cpt -Ba200f100g100 -Bx+l"Moho temperature, \260C" -V -O -K >> $fig

In addition, I ask you if it’s possible to change the color of a map scale plotted. It is plotted in black, but the possible changes would improve the visibility because of the map color.

gmt psbasemap -R -J -L-28.13/0.7/0/40 -V -O -K >> $fig

thanks,
Guilherme

Aren’t you missing the anchor reference with -D? Just from reading your code (haven’t tried it) it looks like you simply shifted a « right bar » to the left.
Try -DjML for example ?

Please provide a minimal working example that creates a plot.
It’s difficult for us to help with a single command that includes -O and -K.

PlanetGus gave you a hint on using the -D option. It looks like your -D option has been specified using an older GMT construct. Here is an example of a map scale from one of my scripts:

gmt psscale -Dx3.25i/-0.7i+w6.5i/0.15i+jBC+h+e -Ct.cpt -Ba+l"Cross-Over Error (m)" -O -K --FORMAT_FLOAT_OUT=%g >> $outdsn

The +jBC informs GMT how to place the annotations. In this case using Bottom-Center (BC). PlanetGus’s suggestion uses ML = Middle-Left.

Other options in my example, include: an “x” immediately following the -D, telling GMT to plot the color bar relative to plot coordinates. In my case I want to create a 6.5 inch wide horizontal scale (hence the +h specifier), located 3.25 inches right and -0.7 inches below the plot origin. The +e specifier tells GMT to put arrows at the end of the color scale. If you omit +h, you’ll (by default) get a vertical scale.

You don’t need to spcify both -Ba and -Bx. This -B specifier will do it all:

-Ba200f100g100+l"Moho temperature, \260C"

Or, you can let GMT determine the best labelling with -Ba+l"Moho temperature, \260C"

Use of psscale is nicely spelled-out in the on-line doc page for psscale

Hello,

A screenshot of the case is attached. I want to change the label to the left side of the color bar. I will follow the instructions provided in previous messages and check if there is a change. Thanks.

Hi John,

I changed the first map initially to test. Here is the code:

gmt psscale -D-1/2.9/4.4/0.3v+jML --FONT_LABEL=10p,Helvetica,black -Clow_dens.cpt -B2+l"Moho depth, km" -O -K >> $fig

However, the color bar was not shown in the plot anymore (picture attached).

Screen Shot 2023-03-15 at 5.33.34 PM

here is the message on terminal:

psscale [WARNING]: Your -D option was interpreted to mean -Dx
psscale [WARNING]: Length v not supported - revert to default unit [cm]
psscale [WARNING]: 2.9/4.4/0.3 not a valid number and may not be decoded properly.
psscale [ERROR]: Option -D: No bar dimensions provided
psscale [ERROR]: Option -D: scale length must be nonzero
psscale [ERROR]: Option -D: scale width must be positive

The errors are informing you that the -D specification is wrong. If the units for the -D specification are centimeters, then try this:

-Dx-1/2.9+w4.4/0.3+jML

The other problem you may have is that there isn’t enough space from the left edge of your plot to successfully place a scale bar there.

Hi John,

Thank you.

I applied your -D example with the changes for the two options +jML and MR to check if the annotation changed the position to the left side of the color bar. However, the annotation continues on the same side. It changed only the position of the color bar in the figure. Please, see the pictures attached. I am trying to fix the text annotation on the left side of the color bar to the map/text is normally visible.

jMR jML

command used:

gmt psscale -Dx-1/2.9+w4.4/0.3+jMR -R -J --FONT_LABEL=10p,Helvetica,black -Clow_dens.cpt -B2+l"Moho depth, km" -O -K >> $fig

I can only emphasize the need to read the documentation:

Append one or more of a , l or u to control which of the annotations, label, and unit that will be moved to the opposite side