Skip to content

GMT figures are not fully isolated in one single session #5279

Closed

Description

@seisman

A bash script to reproduce the issue:

gmt begin

gmt figure makecpt1 pdf
gmt makecpt -Ccategorical -W
gmt colorbar -C -R10/70/-5/10 -B -DJBC

gmt figure other pdf
gmt coast -R0/10/-20/-10 -JM6i -B -Gblack

gmt figure makecpt2 pdf
gmt makecpt -Ccategorical -W
gmt colorbar -C -R10/70/-5/10 -B -DJBC

gmt end

In this example, three figures are generated. The 1st and the 3rd figure uses the same code, so we expect makecpt1.pdf and makecpt2.pdf are the same, but actually, these two images are slightly different. However, if we remove the code for the 2nd figure, makecpt1.pdf and makecpt2.pdf are the same again.

I think it may mean that the "settings" for each "figure" are not fully isolated and it looks like a GMT bug.

Originally posted by @seisman in GenericMappingTools/pygmt#1289 (comment)

Activity

  1. changed the title [-]GMT figures are not fully isolated in one single sessions[/-] [+]GMT figures are not fully isolated in one single session[/+] on May 29, 2021
  2. added
    bug
    on May 29, 2021
  3. PaulWessel commented on May 29, 2021

    @PaulWessel
    Contributor

    Sory, can you help me see the difference between 1 and 3? Looks the same to my old eye.

  4. seisman commented on May 29, 2021

    @seisman
    MemberAuthor

    The size of the annotations is slightly different.

  5. seisman commented on May 29, 2021

    @seisman
    MemberAuthor

    Here is the diff image from

    gm compare -density 200 -highlight-color magenta -highlight-style assign -metric rmse -file diff.png makecpt1.pdf makecpt2.pdf
    

    image

  6. PaulWessel commented on May 29, 2021

    @PaulWessel
    Contributor

    Can you confirm that this seems related to slightly different pens and font values?

  7. seisman commented on May 29, 2021

    @seisman
    MemberAuthor

    I have no idea. I tried to add -Vd to the two colorbar commands separately and check the debugging messages.

    Here are the main differences:

    The first figure shows:

    colorbar [DEBUG]: Anchor point specified via justification code: BC
    colorbar [DEBUG]: Computed automatic parameters using dimension scaling: 1
    colorbar [DEBUG]: Determined colorbar side = S and axis = x
    colorbar [INFORMATION]: No file /Users/seisman/.gmt/sessions/gmt_session.79282/gmt.frame with frame information - no adjustments made
    colorbar [DEBUG]: Bar settings: justify = 10, dx = 0 dy = 0.125
    colorbar [DEBUG]: gmtlib_get_graphics_item: Fig: 1 Subplot: 2 Panel: () Inset: 0
    colorbar [INFORMATION]: Selected current /Users/seisman/.gmt/sessions/gmt_session.79282/gmt.1.cpt file cpt
    

    but the second figure show:

    colorbar [DEBUG]: Anchor point specified via justification code: BC
    colorbar [DEBUG]: Computed automatic parameters using dimension scaling: 1
    colorbar [DEBUG]: Determined colorbar side = S and axis = x
    colorbar [DEBUG]: B item = 
    
    colorbar [DEBUG]: Adding annotation space
    colorbar [DEBUG]: gmtlib_get_graphics_item: Fig: 3 Subplot: 2 Panel: () Inset: 0
    colorbar [DEBUG]: Reading GMT Default parameters from file: /Users/seisman/.gmt/sessions/gmt_session.79328/gmt.conf
    colorbar [DEBUG]: Bar settings: justify = 10, dx = 0 dy = 0.324444
    colorbar [DEBUG]: gmtlib_get_graphics_item: Fig: 3 Subplot: 2 Panel: () Inset: 0
    colorbar [INFORMATION]: Selected current /Users/seisman/.gmt/sessions/gmt_session.79328/gmt.3.cpt file cpt
    
  8. PaulWessel commented on May 29, 2021

    @PaulWessel
    Contributor

    Thanks, that gmt.frame message is the information I need: Looks like that file needs to get the same treatment as other files and be per-figure, per-subset, etc. It is using that file from the 2nd plot which is unrelated. I will start a separate fix.

  9. added a commit that references this issue on May 29, 2021
    82a925d
  10. added a commit that references this issue on May 29, 2021
    ddfdc49
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions