Skip to content

Option to set MAP_LABEL_OFFSET to be relative to axis #5182

Closed

Description

@evangowan

Description of the desired feature

Right now, the MAP_LABEL_OFFSET option for placing the axis label text is set to be relative to the side of the annotations. For stacked plots (e.g. a stack of time series), this can lead to the problem of the labels not being aligned on all of the plots if the annotations are of difference sizes. Ideally, an option to set the MAP_LABEL_OFFSET to be relative to the axis rather than the annotation would make it easier to line things up.

To illustrate what I mean, I have attached this image. As you can see, the label “Sliding Mechanism” is much further to the left of the other labels.

labels

There is some further discussion on the GMT forum

As mentioned in the post, the workaround for now is to use gmt text -N.

Are you willing to help implement and maintain this feature? No

Activity

  1. added
    feature request
    on Apr 29, 2021
  2. added this to the Future release milestone on May 6, 2021
  3. PaulWessel commented on May 8, 2021

    @PaulWessel
    Contributor

    Might it be possible for you to post the script that made the example above? It would make a good test when I implement the feature.

  4. evangowan commented on May 26, 2021

    @evangowan
    Author

    Dear Paul,

    I apologize for the delay. I have created a test script that you can use.

    #! /bin/bash
    
    
    
    font_label="--FONT_LABEL=10p --MAP_LABEL_OFFSET=6p"
    font_anno="--FONT_ANNOT_PRIMARY=8p"
    
    loess_line="2p"
    dot_size="0.1"
    
    plot="test.ps"
    
    
    plot_width=8c
    plot_height=2c
    
    xmin=6
    xmax=17
    
    ############## C4
    
    parameter="C4"
    ymin=0
    ymax=24.9
    ytick=10
    ysubtick=5
    axis_label="C@-4@- (%)"
    
    J_options="-JX${plot_width}/${plot_height}"
    R_options="-R${xmin}/${xmax}/${ymin}/${ymax}"
    
    
    
    gmt psbasemap  -BWSen -Bxa2f1+l"Age (Ma)" -Bya${ytick}f${ysubtick}+l"${axis_label}"  ${J_options} ${R_options} -P  -K ${font_label} ${font_anno} > ${plot}
    
    
    
    
    ############## MC total
    
    parameter=MC_total
    
    ymin=80
    ymax=12000
    axis_label="MC@-T@-"
    
    
    J_options="-JX${plot_width}/${plot_height}l"
    R_options="-R${xmin}/${xmax}/${ymin}/${ymax}"
    
    
    
    gmt psbasemap -Y${plot_height} -BWsen -Bya1f3p+l"${axis_label} (grain/g)"  ${J_options} ${R_options} -P -K -O ${font_label} ${font_anno} >> ${plot}
    
    
    
    ############## MC_L / MC_R
    
    parameter="Total_L_Total_R"
    
    ymin=0.01
    ymax=0.39
    ytick=0.1
    ysubtick=0.05
    axis_label="MC@-L@-/MC@-R@-"
    
    
    J_options="-JX${plot_width}/${plot_height}"
    R_options="-R${xmin}/${xmax}/${ymin}/${ymax}"
    
    
    gmt psbasemap  -Y${plot_height}  -BWsen  -Bya${ytick}f${ysubtick}+l"${axis_label}"  ${J_options} ${R_options} -P -O -K ${font_label} ${font_anno} >> ${plot}
    
    ############## Grasses Yanwan
    
    parameter="Yanwan_Grasses" 
    
    ymin=0.1
    ymax=99.9
    ytick=20
    ysubtick=10
    axis_label="Grass (%)"
    
    
    J_options="-JX${plot_width}/${plot_height}"
    R_options="-R${xmin}/${xmax}/${ymin}/${ymax}"
    
    
    gmt psbasemap  -Y${plot_height}   -BWsen  -Bya${ytick}f${ysubtick}+l"${axis_label}"  ${J_options} ${R_options} -P -O -K  ${font_label} ${font_anno} >> ${plot}
    
    
    
    ############## Grasses Yaodian
    
    parameter="Yaodian_Grasses"
    
    ymin=0.1
    ymax=99.9
    ytick=20
    ysubtick=10
    axis_label="Grass (%)"
    
    
    J_options="-JX${plot_width}/${plot_height}"
    R_options="-R${xmin}/${xmax}/${ymin}/${ymax}"
    
    
    
    gmt psbasemap   -Y${plot_height}  -BWsen  -Bya${ytick}f${ysubtick}+l"${axis_label}"  ${J_options} ${R_options} -P -O -K  ${font_label} ${font_anno} >> ${plot}
    
    
    ############## Mammal fossils
    
    
    ymin=0
    ymax=2
    y_half=1
    ytick=1
    ysubtick=5
    axis_label="Fossils"
    parameter="mammal_fossils"
    
    J_options="-JX${plot_width}/${plot_height}"
    R_options="-R${xmin}/${xmax}/${ymin}/${ymax}"
    
    
    
    gmt psbasemap   -Y${plot_height}  -BWsen -Bxa100 -By+l"${axis_label}"   ${J_options} ${R_options}  -P -K -O  ${font_label} ${font_anno} >> ${plot}
    
    
    ############## Mammal fossils
    
    
    ymin=2801
    ymax=4099
    y_half=1
    ytick=1
    ysubtick=5
    axis_label="MSH"
    parameter="MSH"
    
    J_options="-JX${plot_width}/${plot_height}"
    R_options="-R${xmin}/${xmax}/${ymin}/${ymax}"
    
    
    
    gmt psbasemap    -Y${plot_height} -BWsen  -Bya400+200f100+l"${axis_label}"     ${J_options} ${R_options}  -P -K -O  ${font_label} ${font_anno} >> ${plot}
    
    ################## CO2
    
    parameter="CO2"
    
    ymin=50
    ymax=399
    ytick=100
    ysubtick=25
    axis_label="CO@-2@- (PPM)"
    
    
    J_options="-JX${plot_width}/${plot_height}"
    R_options="-R${xmin}/${xmax}/${ymin}/${ymax}"
    
    
    gmt psbasemap   -Y${plot_height} -BWsen  -Bya${ytick}f${ysubtick}+l"${axis_label}"  ${J_options} ${R_options} -P -O -K  ${font_label} ${font_anno} >> ${plot}
    
    
    
    ############ Tectonic
    
    ymin=0
    ymax=1
    y_half=1
    ytick=1
    ysubtick=5
    axis_label="Tectonics"
    parameter="tectonic_events"
    
    J_options="-JX${plot_width}/${plot_height}"
    R_options="-R${xmin}/${xmax}/${ymin}/${ymax}"
    
    
    
    gmt psbasemap   -Y${plot_height} -BWsen  -Bxa100 -By+l"${axis_label}"  ${J_options} ${R_options}  -P -O   ${font_label} ${font_anno}  >> ${plot}
    
  5. PaulWessel commented on Jun 19, 2021

    @PaulWessel
    Contributor

    This has been implemented by #5320.

  6. removed this from the Future release milestone on Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions