# Psscale and map scale position/color

**URL:** <https://forum.generic-mapping-tools.org/t/psscale-and-map-scale-position-color/3755>\
**Category:** Q&A\
**Created:** [March 14, 2023, 10:56pm UTC](https://forum.generic-mapping-tools.org/t/psscale-and-map-scale-position-color/3755 "2023-03-14T22:56:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gwsmelo](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gwsmelo](https://forum.generic-mapping-tools.org/u/gwsmelo)\
**Post date:** [March 14, 2023, 10:56pm UTC](https://forum.generic-mapping-tools.org/t/psscale-and-map-scale-position-color/3755/1 "2023-03-14T22:56:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![PlanetGus](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/planetgus/32/303_2.png) [@PlanetGus](https://forum.generic-mapping-tools.org/u/PlanetGus)\
**Post date:** [March 15, 2023, 8:06am UTC](https://forum.generic-mapping-tools.org/t/psscale-and-map-scale-position-color/3755/2 "2023-03-15T08:06:04Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://forum.generic-mapping-tools.org/u/Andreas)\
**Post date:** [March 15, 2023, 8:10am UTC](https://forum.generic-mapping-tools.org/t/psscale-and-map-scale-position-color/3755/3 "2023-03-15T08:10:15Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![John\_Geodesy](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/john_geodesy/32/116_2.png) [@John\_Geodesy](https://forum.generic-mapping-tools.org/u/John_Geodesy)\
**Post date:** [March 15, 2023, 4:13pm UTC](https://forum.generic-mapping-tools.org/t/psscale-and-map-scale-position-color/3755/4 "2023-03-15T16:13:33Z")

</div>

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](https://docs.generic-mapping-tools.org/dev/psscale.html)

---

<div class="post-metadata">

**Author:** ![gwsmelo](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gwsmelo](https://forum.generic-mapping-tools.org/u/gwsmelo)\
**Post date:** [March 15, 2023, 8:25pm UTC](https://forum.generic-mapping-tools.org/t/psscale-and-map-scale-position-color/3755/5 "2023-03-15T20:25:06Z")

</div>

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.

 ![Screen Shot 2023-03-15 at 3.12.10 PM](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/a/ae4184b047551c1e5bc2e6c7147e155617cba0da.jpeg)

---

<div class="post-metadata">

**Author:** ![gwsmelo](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gwsmelo](https://forum.generic-mapping-tools.org/u/gwsmelo)\
**Post date:** [March 15, 2023, 9:35pm UTC](https://forum.generic-mapping-tools.org/t/psscale-and-map-scale-position-color/3755/6 "2023-03-15T21:35:14Z")

</div>

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](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/8/8ab9cc763d85f2bf447e2e6f9a58896b9e99715d.png)

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

---

<div class="post-metadata">

**Author:** ![John\_Geodesy](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/john_geodesy/32/116_2.png) [@John\_Geodesy](https://forum.generic-mapping-tools.org/u/John_Geodesy)\
**Post date:** [March 15, 2023, 9:59pm UTC](https://forum.generic-mapping-tools.org/t/psscale-and-map-scale-position-color/3755/7 "2023-03-15T21:59:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gwsmelo](https://avatars.discourse-cdn.com/v4/letter/g/9fc348/32.png) [@gwsmelo](https://forum.generic-mapping-tools.org/u/gwsmelo)\
**Post date:** [March 15, 2023, 10:24pm UTC](https://forum.generic-mapping-tools.org/t/psscale-and-map-scale-position-color/3755/8 "2023-03-15T22:24:51Z")

</div>

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](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/6/6e0e4a52207d92402e15f27d236e63fc293b3dbc.png) ![jML](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/b/be2a08fc0cadc70d430016e4ac5580af2ed79745.png)

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

---

<div class="post-metadata">

**Author:** ![PlanetGus](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/planetgus/32/303_2.png) [@PlanetGus](https://forum.generic-mapping-tools.org/u/PlanetGus)\
**Post date:** [March 16, 2023, 8:38am UTC](https://forum.generic-mapping-tools.org/t/psscale-and-map-scale-position-color/3755/9 "2023-03-16T08:38:19Z")

</div>

> [@John\_Geodesy](#):
>
> Use of psscale is nicely spelled-out in the on-line doc page for [psscale](https://docs.generic-mapping-tools.org/dev/psscale.html)

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
