Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
seisman opened this issue May 29, 2021 · 6 comments · Fixed by #5280
Closed

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

seisman opened this issue May 29, 2021 · 6 comments · Fixed by #5280
Labels
bug Something isn't working

Comments

@seisman
Copy link
Member

seisman commented May 29, 2021

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)

@seisman seisman transferred this issue from GenericMappingTools/pygmt May 29, 2021
@seisman seisman changed the title GMT figures are not fully isolated in one single sessions GMT figures are not fully isolated in one single session May 29, 2021
@seisman seisman added the bug Something isn't working label May 29, 2021
@PaulWessel
Copy link
Member

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

@seisman
Copy link
Member Author

seisman commented May 29, 2021

The size of the annotations is slightly different.

@seisman
Copy link
Member Author

seisman commented May 29, 2021

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

@PaulWessel
Copy link
Member

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

@seisman
Copy link
Member Author

seisman commented May 29, 2021

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

@PaulWessel
Copy link
Member

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.

PaulWessel added a commit that referenced this issue May 29, 2021
Otherwise information from one completed figure may leak into another, causing small differences.  Tests pass, and no difference in the original post. Closes #5279.
PaulWessel added a commit that referenced this issue May 29, 2021
Otherwise information from one completed figure may leak into another, causing small differences.  Tests pass, and no difference in the original post. Closes #5279.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants