Skip to content

Colorbar annotations plotting incorrectly when used in an inset plot. #8690

@ESaltPi

Description

@ESaltPi

Description of the problem
The tick marks are not aligning to the correct place on the color scale and thus there is some text that is well off the scale. You will see that I have plotted three insets below the main figure. The colorbar is part of the middle inset, yet the 2000 annotation plots near the right inset. Based on the cpt which i set to go from 5000 to 2000, the 1000’s should be placed on the actual bar. A solution does exist to fix the problem, but I believe that this is still a bug.

Full script that generated the error

#!/bin/bash

gmt begin Gofar625_79_inset_TEST ps,pdf,png E720 -C

gmt gmtset PROJ_LENGTH_UNIT inch
gmt gmtset PS_MEDIA archA
gmt gmtset FONT_ANNOT_PRIMARY 8,Helvetica,black
gmt gmtset FONT_ANNOT_SECONDARY 8,Helvetica,black
gmt gmtset FONT_LABEL 8,Helvetica,black
gmt gmtset FONT_TITLE 10,Helvetica,black
gmt gmtset PS_PAGE_ORIENTATION LANDSCAPE
gmt gmtset COLOR_BACKGROUND black
gmt gmtset COLOR_FOREGROUND white
gmt gmtset COLOR_NAN white

gmt gmtset FORMAT_GEO_MAP ddd.x
gmt gmtset MAP_FRAME_WIDTH 3p
gmt gmtset MAP_ANNOT_OFFSET_PRIMARY 5p

gmt basemap -Bpxa.02f.01 -Bpya.01 -R104.9745W/104.825W/4.575S/4.529S -JM10.5i -BNSWE+t"Preliminary Bathymetry with Earthquakes" \
            -LjRT+o0.2+w2k+f+l"Scale (km)" --MAP_TICK_LENGTH=0p --MAP_ANNOT_OBLIQUE=lat_parallel -Xc -Y3.25i

gmt inset begin -R-123.5/-30/-61/31r -JS-100/0/2i -DJLB+o-2.05i/0.4i -F+gwhite+p0.5p,black
gmt basemap -R-123.5/-30/-61/31r -JS-100/0/2i -Bxa10f5 -Bya10f5 \
        --MAP_FRAME_TYPE=inside --MAP_FRAME_AXES=eslt
gmt basemap -R-123.5/-30/-61/31r -JS-100/0/2i -Bxa30 -Bya30 \
        --MAP_FRAME_TYPE=inside -BSE --FORMAT_GEO_MAP=DDDG --FONT_ANNOT_PRIMARY=4,Helvetica,black
gmt inset end

gmt inset begin -R106.5W/102.0W/5.25S/3.25S -JM5i -DJRB+o-5.05i/0.4i -F+gwhite+p0.5p,black
gmt basemap -Bpxa1f0.5 -Bpya0.5f0.5 -LjLT+o0.2+w100k+l"Scale (km)" -BSEnw \
            --MAP_FRAME_TYPE=inside --MAP_FRAME_AXES=eslt --FORMAT_GEO_MAP=ddd.x
gmt inset end

gmt inset begin -R105.2W/104.6W/4.75S/4.4S -JM3i -DJLB+o-5.25i/0.4i -F+gwhite+p0.5p,black -N
gmt makecpt -Chaxby -T-5000/-2000 -H > haxby.cpt
gmt basemap -Bpxa0.2 -Bpya0.1 -LjLT+o0.2+w10k+l"Scale (km)" -BSEnw \
            --MAP_FRAME_TYPE=inside --MAP_FRAME_AXES=eslt --FORMAT_GEO_MAP=ddd.x
gmt colorbar -Chaxby.cpt -DJCB+w2.6i/0.1i+o0.0i/0.25i+h+ml -Bxa1000f250+l"Bathymetry Depth" -By+lm
rm -f haxby.cpt
gmt inset end

gmt end show

Actual outcome

Gofar625_79_inset_TEST.pdf

Expected outcome

The annotations on the bottom of the colorbar attached to the middle inset do not plot in the correct locations. A solution does exist to fix this bug: add your -R and -J parameters into the colorbar function.

System information

  • Operating system: Linux 22.04
  • GMT version (gmt --version): 6.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions