GenericMappingTools / gmt

The Generic Mapping Tools
https://www.generic-mapping-tools.org
Other
861 stars 359 forks source link

Colorbar: Size of side triangles affects size of NaN box #8343

Closed yvonnefroehlich closed 9 months ago

yvonnefroehlich commented 9 months ago

Description of the problem

The size of the side triangles (+elength) of a colorbar affect also the size of the NaN box (+n).

Full script that generated the error

gmt begin

    gmt basemap -R-1/1/-1/1 -JX10c -Brltb
    gmt makecpt -Cnavia -T0/42/1
    gmt colorbar -DjTC+h+e+n -B 
    gmt colorbar -DjMC+h+e0.5c+n -B

gmt end show

Full error message

No error message occurs.

Click Output of -Vd

``` gmt [DEBUG]: GMT_Create_Session: Terminal width = 191 gmt [DEBUG]: Obtained the ppid from parent: 15240 gmt [DEBUG]: Enter: gmtinit_new_GMT_ctrl gmt [DEBUG]: GMT->session.SHAREDIR = C:/Program Files (x86)/gmt6/share gmt [DEBUG]: GMT->session.HOMEDIR = C:/Users/Admin gmt [DEBUG]: GMT->session.USERDIR = C:/Users/Admin/.gmt [created] gmt [DEBUG]: GMT->session.CACHEDIR = C:/Users/Admin/.gmt/cache [created] gmt [DEBUG]: GMT: 0. Will try to find subdir=postscriptlight stem = PSL_custom_fonts suffix=.txt gmt [DEBUG]: GMT: 1. gmt_getsharepath trying current dir gmt [DEBUG]: GMT: 2. gmt_getsharepath trying USERDIR C:/Users/Admin/.gmt gmt [DEBUG]: GMT: 3. gmt_getsharepath trying USERDIR subdir C:/Users/Admin/.gmt/postscriptlight gmt [DEBUG]: GMT: 4. gmt_getsharepath trying SHAREDIR subdir C:/Program Files (x86)/gmt6/share/postscriptlight gmt [DEBUG]: GMT: 5. gmt_getsharepath trying SHAREDIR C:/Program Files (x86)/gmt6/share gmt [DEBUG]: GMT: 6. gmt_getsharepath failed gmt [DEBUG]: Map distance calculation will be Cartesian gmt [DEBUG]: Exit: gmtinit_new_GMT_ctrl gmt [DEBUG]: Enter: New_PSL_Ctrl gmt [DEBUG]: Exit: New_PSL_Ctrl gmt [DEBUG]: Enter: gmt_manage_workflow gmt [DEBUG]: GMT now running in modern mode [Session ID = 15240] gmt [DEBUG]: Exit : gmt_manage_workflow gmt [DEBUG]: Enter: PSL_beginsession gmt [DEBUG]: Exit : PSL_beginsession gmt [DEBUG]: Enter: PSL_setdefaults gmt [DEBUG]: Exit : PSL_setdefaults gmt [DEBUG]: Enter: gmtlib_io_init gmt [DEBUG]: Exit : gmtlib_io_init gmt [DEBUG]: Enter: gmt_hash_init gmt [DEBUG]: Exit: gmt_hash_init gmt [DEBUG]: Enter: gmt_hash_init gmt [DEBUG]: Exit: gmt_hash_init gmt [DEBUG]: Enter: gmt_reload_settings gmt [DEBUG]: The PROJ_GEODESIC set to Vincenty gmt [DEBUG]: gmtlib_get_graphics_item: Fig: 0 Subplot: 2 Panel: () Inset: 0 gmt [DEBUG]: Reading GMT Default parameters from file: C:/Users/Admin/.gmt/sessions/gmt_session.15240/gmt.conf gmt [DEBUG]: Exit: gmt_reload_settings gmt [DEBUG]: Enter: gmtlib_plot_C_format gmt [DEBUG]: Exit: gmtlib_plot_C_format gmt [DEBUG]: Enter: gmtinit_get_history gmt [DEBUG]: gmtlib_get_graphics_item: Fig: 0 Subplot: 2 Panel: () Inset: 0 gmt [DEBUG]: Enter: gmt_hash_init gmt [DEBUG]: Exit: gmt_hash_init gmt [DEBUG]: Failed to release lock (Error <158>: Die Sperre des Segments ist bereits aufgehoben. ) gmt [DEBUG]: Exit: gmtinit_get_history gmt [DEBUG]: Initialize FFTW with 4 threads. gmt [DEBUG]: GMT_Create_Session initialized GMT structure gmt [DEBUG]: Loading core GMT shared library: gmt.dll gmt [DEBUG]: Shared Library # 0 (core). Path = gmt.dll gmt [DEBUG]: Loading GMT plugins from: C:/ProgramData/Anaconda3/envs/gmt_env_dev/Library/bin/gmt_plugins gmt [DEBUG]: Shared Library # 1 (supplements). Path = C:/ProgramData/Anaconda3/envs/gmt_env_dev/Library/bin/gmt_plugins/supplements.dll gmt [DEBUG]: GMT now running in modern mode [Session ID = 15240] gmt [DEBUG]: Use PS filename C:/Users/Admin/.gmt/sessions/gmt_session.15240/gmt_0.ps- gmt [DEBUG]: gmtinit_get_current_panel: No current panel selected so not in subplot mode gmt [DEBUG]: Modern mode: Added -R to options since history is available [-1/1/-1/1]. gmt [DEBUG]: Modern: Adding -J to options since history is available [X10c]. gmt [DEBUG]: Revised options: -DjMC+h+e0.5c+n -B -Vd -R -J colorbar [DEBUG]: History: Process -R colorbar [DEBUG]: History: Process -J colorbar [DEBUG]: Got regular w/e/s/n for region (-1/1/-1/1) colorbar [DEBUG]: Anchor point specified via justification code: MC colorbar [DEBUG]: Computed automatic parameters using dimension scaling: 1 colorbar [DEBUG]: Bar settings: justify = 6, dx = 0 dy = 0 colorbar [DEBUG]: gmtlib_get_graphics_item: Fig: 0 Subplot: 2 Panel: () Inset: 0 colorbar [INFORMATION]: Selected current C:/Users/Admin/.gmt/sessions/gmt_session.15240/gmt.cpt file cpt colorbar [DEBUG]: gmtlib_get_graphics_item: Fig: 0 Subplot: 2 Panel: () Inset: 0 colorbar [INFORMATION]: Selected current C:/Users/Admin/.gmt/sessions/gmt_session.15240/gmt.cpt file cpt colorbar [INFORMATION]: Processing input CPT colorbar [DEBUG]: Found readable file C:/Users/Admin/.gmt/sessions/gmt_session.15240/gmt.cpt colorbar [DEBUG]: Found readable file C:/Users/Admin/.gmt/sessions/gmt_session.15240/gmt.cpt colorbar [DEBUG]: Given full path to file C:/Users/Admin/.gmt/sessions/gmt_session.15240/gmt.cpt colorbar [DEBUG]: Found readable file C:/Users/Admin/.gmt/sessions/gmt_session.15240/gmt.cpt colorbar [DEBUG]: Object ID 0 : Registered CPT File C:/Users/Admin/.gmt/sessions/gmt_session.15240/gmt.cpt as an Input resource with geometry Volume [n_objects = 1] colorbar [DEBUG]: gmtapi_begin_io: Input resource access is now enabled [container] colorbar [DEBUG]: gmtapi_import_palette: Passed ID = 0 and mode = 0 colorbar [INFORMATION]: Reading CPT from File C:/Users/Admin/.gmt/sessions/gmt_session.15240/gmt.cpt colorbar [DEBUG]: Reading CPT from C:/Users/Admin/.gmt/sessions/gmt_session.15240/gmt.cpt colorbar [DEBUG]: GMT_End_IO: Input resource access is now disabled colorbar [INFORMATION]: CPT range from 0 to 42 colorbar [DEBUG]: Reset MAP_ANNOT_OBLIQUE to anywhere colorbar [DEBUG]: Projected values in meters: -1 1 -1 1 colorbar [INFORMATION]: Linear projection implies y-axis distance exaggeration relative to the x-axis by a factor of 1 colorbar [DEBUG]: Auto-frame interval for axis 0 item 0: d = 0.5 f = 0.1 colorbar [INFORMATION]: Auto-frame interval for x-axis (item 0): a0.5f0.1 colorbar [DEBUG]: Auto-frame interval for axis 1 item 0: d = 0.5 f = 0.1 colorbar [INFORMATION]: Auto-frame interval for y-axis (item 0): a0.5f0.1 colorbar [INFORMATION]: Map scale is 0.0002 km per cm or 1:20. colorbar [DEBUG]: Converted code 6 to i = 2, j = 1 and finally x = 1.9685 and y = 1.9685 colorbar [DEBUG]: Convert code inside reference point coordinates from justification CM to 0, 0 colorbar [DEBUG]: Scale mapping set to -JX3.14961i/0.125984i colorbar [DEBUG]: Running in PS mode modern colorbar [DEBUG]: Use PS filename C:/Users/Admin/.gmt/sessions/gmt_session.15240/gmt_0.ps- colorbar [DEBUG]: Append to hidden PS file C:/Users/Admin/.gmt/sessions/gmt_session.15240/gmt_0.ps- colorbar [DEBUG]: No figure file C:/Users/Admin/.gmt/sessions/gmt_session.15240/gmt.figures - nothing to do colorbar [DEBUG]: Reset MAP_ANNOT_OBLIQUE to anywhere colorbar [DEBUG]: Projected values in meters: 0 42 0 0.125984 colorbar [INFORMATION]: Linear projection implies y-axis distance exaggeration relative to the x-axis by a factor of 13.335 colorbar [INFORMATION]: Map scale is 0.00524999 km per cm or 1:524.999. colorbar [DEBUG]: Clean re reparse -B settings colorbar [DEBUG]: Before justify = 6, Dim x = 3.14961 y = 0.125984, Reference x = 1.9685 y = 1.9685 colorbar [DEBUG]: After justify = 6, Offset x = 0 y = 0, Reference x = 0.393701 y = 1.90551 colorbar [DEBUG]: After shifts, Reference x = 0.393701 y = 1.90551 colorbar [DEBUG]: After shifts, Bar reference x = 0.393701 y = 1.90551 colorbar [DEBUG]: Auto-frame interval for axis 0 item 0: d = 10 f = 2 colorbar [INFORMATION]: Auto-frame interval for x-axis (item 0): a10f2 colorbar [DEBUG]: Color bar will be plotted using polygons colorbar [DEBUG]: Color bar parameters scaled by 0.730297 colorbar [DEBUG]: Current size of half-baked PS file C:/Users/Admin/.gmt/sessions/gmt_session.15240/gmt_0.ps- = 28734. colorbar [DEBUG]: gmtlib_garbage_collection: Destroying object: C=0 A=0 ID=0 W=Input F=CPT M=File S=Used P=230eb01dec0 N=C:/Users/Admin/.gmt/sessions/gmt_session.15240/gmt.cpt colorbar [DEBUG]: GMTAPI_Garbage_Collection freed 1 memory objects colorbar [DEBUG]: gmtlib_unregister_io: Unregistering object no 0 [n_objects = 0] gmt [DEBUG]: Entering GMT_Destroy_Session gmt [DEBUG]: gmtlib_get_graphics_item: Fig: 0 Subplot: 2 Panel: () Inset: 0 gmt [DEBUG]: Failed to release lock (Error <158>: Die Sperre des Segments ist bereits aufgehoben. ```

Actual outcome

colorbar_e_n_size

Expected outcome

The size of the NaN box should be independent of the size of the side triangles of the colorbar.

System information

PaulWessel commented 9 months ago

it is true that:

Nan box quietly takes on size base on the triangle side set with +e with no documentation. No mechanism was implemented to specify size of square.

Possible solutions:

  1. Ignore +e size and let NaN square always be the bar width only.
  2. Update +n to be +n[size][label]. May be messy since +n0.5c may mean use NaN label 0.5c and not set size? How would we foolproof that?
  3. I think being able to choose custom size would be great,

Thoughts?

joa-quim commented 9 months ago

I think 1. is good enough.

... Postscript spheres are so much more important than these minor things.

PaulWessel commented 9 months ago

If anyone can implement solution #1 please do. Looks like I wont be doing much coding right now...

PaulWessel commented 9 months ago

No time to do postscript spheres but certainly important. Probably you or Remko could do them.