GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix incorrect font for colorbar unit by PaulWessel · Pull Request #6802 · GenericMappingTools/gmt

Conversation

@PaulWessel

@PaulWessel PaulWessel commented Jun 17, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

See #6799 for background. The label on the color bar for units was set using annotation font and offset instead of the correct label font and offset. @seisman, please build and run tests and see if you agree with me that the ~35 failing tests are better with the larger font for label and in line with other use of labels. We can then address this after 6.4 as a bug fix.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@PaulWessel
Fix incorrect font for colorbar unit
ed6ee78
The label on the color bar for units was set using annotation font and offset instead of the correct label font and offset.
@PaulWessel PaulWessel added the bug Something isn't working label Jun 17, 2022
@PaulWessel PaulWessel added this to the Future release milestone Jun 17, 2022
@PaulWessel
PaulWessel requested a review from seisman June 17, 2022 18:40
@PaulWessel PaulWessel self-assigned this Jun 17, 2022
@PaulWessel
Update psscale.c
bf2540d
@PaulWessel

PaulWessel commented Jun 17, 2022

Copy link
Copy Markdown
Contributor Author

Just pinging @GenericMappingTools/core as well for now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulWessel
Merge branch 'master' into colorbar-unit
4ba2819
@PaulWessel PaulWessel modified the milestones: Future release, 6.5.0 Jun 19, 2022
@seisman seisman modified the milestones: 6.4.0, 6.5.0 Jun 25, 2022
@PaulWessel
Merge branch 'master' into colorbar-unit
5cbf508
@PaulWessel

PaulWessel commented Jul 3, 2022

Copy link
Copy Markdown
Contributor Author

Have not heard back from anybody about this so pinging @seisman, @maxrjones, @joa-quim and @Esteban82. Perhaps it is worth more discussion. Here is what master currently does, using the FONT_ANNOT_PRIMARY [12p] for the y-axis label:

master

This PR would declare a bug and state that as for all basemaps the FONT_LABEL [16p] should be used instead, giving

wip

Once could argue that colorbars are very unusual basemaps in that one axis is much longer than the other (factor 20 by default) and that the short axis is never annotated or ticked. Hence, using the label font for a short unit label seems too large. This is of course why I switched to the annotation font decades ago.

However, as it is we are unable to change it independently of the axis annotation, and this WIP solution would affect both axes labels. An alternative would be to declare the bug differently and say it was meant to be the secondary annotation font FONT_ANNOT_SECONDARY [14p] instead of the primary, thus allowing for

  • A smaller default font size than label font [14p vs 16p]
  • A way to change it without affecting the annotation or main axis label settings

I must say this type of bug-fix offers a better solution for this type of plot. Thoughts?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@maxrjones

maxrjones commented Jul 3, 2022

Copy link
Copy Markdown
Member

I must say this type of bug-fix offers a better solution for this type of plot

agreed, for this case it is important for the unit label to be controlled independently from the colorbar label

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joa-quim

joa-quim commented Jul 3, 2022

Copy link
Copy Markdown
Member

I don't like the bottom example. Font is way too big. But agree that a different control for the two labels (with a nice default, auto-scaled?) is useful.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulWessel

PaulWessel commented Jul 3, 2022

Copy link
Copy Markdown
Contributor Author

Yes true. The whole concept of treating the tiny colormap as a basemap with the same defaults as an actual basemap is wrong. It would seem that the font sizes, ticks etc ought to scale with the color bar length, independent of the auto-scaling for the map it is attached to. Otherwise one has to do a lot of --PAR=value to make it look OK.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@WalterHFSmith

WalterHFSmith commented Jul 4, 2022 via email

Copy link
Copy Markdown
Contributor
Interesting example. I have never seen “inches” used this way. I usually see “Hairlength, inches” or “Hairlength (inches)” on the x label.
…
On Jul 3, 2022, at 10:57 AM, Paul Wessel ***@***.***> wrote: Yes true. The whole concept of treating the tiny colormap as a basemap with the same defaults as an actual basemap is wrong. It would seem that the font sizes, ticks etc ought to scale with the color bar length, independent of the auto-scaling for the map it is attached to. Otherwise one has to do a lot of --PAR=value to make it look OK. — Reply to this email directly, view it on GitHub <#6802 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/APUT6GNOBE4EO545GBKVANLVSGS6HANCNFSM5ZDDEBYA>. You are receiving this because you are on a team that was mentioned.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulWessel

PaulWessel commented Jul 4, 2022

Copy link
Copy Markdown
Contributor Author

Well, it was just a dumb example to show font size. Normally all my research into hair-length uses proper SI units.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulWessel
Merge branch 'master' into colorbar-unit
4531394
@PaulWessel

PaulWessel commented Aug 15, 2022

Copy link
Copy Markdown
Contributor Author

I want to wrap this up. Sounds like we are in agreement that this is a good fix and that perhaps further work on default sizes is needed, but that is separate from this fix. Unless I hear fussing I will update those 35 PS files given this fix and complete it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

PaulWessel added 2 commits April 7, 2023 15:13
@PaulWessel
Merge branch 'master' into colorbar-unit
699297b
@PaulWessel
Go with the secondary bug solution
27953ad
@PaulWessel

PaulWessel commented Apr 7, 2023

Copy link
Copy Markdown
Contributor Author

I am resurrecting this stale PR from last year. I decided (as I think we agreed) to use the SECONDARY annotation parameters for the little unit on the side of the bar instead of LABEL which is too big. This way, the original request in #6799 is addressed.

This will cause a bunch of failures but with gs 10 and Xcode update I have plenty already. Hoping @seisman has some clear thinking on what to do next.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

PaulWessel added 2 commits April 7, 2023 15:32
@PaulWessel
Merge branch 'master' into colorbar-unit
b4ea61e
@PaulWessel
Merge branch 'master' into colorbar-unit
c3237b2
@PaulWessel

PaulWessel commented Apr 26, 2023

Copy link
Copy Markdown
Contributor Author

@GenericMappingTools/core, shall we bite the bullet here and go with FONT_ANNOT_SECONDARY for the y-annotations instead of FONT_LABEL, and then deal with the tens of PostSCript files that need to be updated given the change? Otherwise this PR will sit here until nobody will remember what to do.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulWessel
Merge branch 'master' into colorbar-unit
71baecb
@joa-quim

joa-quim commented Apr 26, 2023

Copy link
Copy Markdown
Member

I guess there is no escape from that (the ps updates). But, given the current ghost/gm partnership screwing of good PSs, how to tell the new failures due to this change from the others?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulWessel

PaulWessel commented Apr 26, 2023

Copy link
Copy Markdown
Contributor Author

These are easy since they only affect colorers with y-label. The font size change so they all fail.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulWessel
Merge branch 'master' into colorbar-unit
cbb69c7
@PaulWessel

PaulWessel commented Aug 29, 2023

Copy link
Copy Markdown
Contributor Author

OK, we do want this fixed issue merged before 6.5. The PR allows both sides of the annotations to be different. I have noted @joa-quim's complaint that both fonts are too large. I can agree with that. In modern mode, map annotations adjust depending on map dimensions, but annotations for colorbar and presumably scales etc. are fixed and can only be adjusted with a --FONT_LABEL=... etc.

Here are two color bars, first is 15 cm the other is 3 cm. The first looks OK but the second clearly need smaller fonts (and frame pen).

15 cm:
s

3 cm:
s2

Perhaps the default font sizes should at least in modern theme like other fonts be scaled based on bar length.

To prevent backlash I think if the relevant default settings are adjusted by the user (e.g., to deal with the 3cm case) I think we leave as is, otherwise we do the default re-scaling
Give me your thoughts, @GenericMappingTools/core .

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joa-quim

joa-quim commented Aug 29, 2023

Copy link
Copy Markdown
Member

Not sure I understood what you are proposing. Leaving the 3 cm example as is by default? I think it should be scaled. No reason to produce an ugly fig when we can do better.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulWessel

PaulWessel commented Aug 29, 2023

Copy link
Copy Markdown
Contributor Author

I mean we should auto-scale colorbars annotations like we do for a map, so that a 3 cm colobar will have smaller annotations than the20x20 cm map it may be inserted inti. The 3c is just what we get now and it is ugly.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joa-quim

joa-quim commented Aug 29, 2023

Copy link
Copy Markdown
Member

Ah, OK we are in agreement.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

PaulWessel added 2 commits August 29, 2023 14:25
@PaulWessel
Merge branch 'master' into colorbar-unit
b36f293
@PaulWessel
Update psscale.c
5ad7c9e
@PaulWessel

PaulWessel commented Aug 29, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Update this colorbar-unit branch, build, and run this script. It simply uses a 15 cm bar for reference and then scales all parameters down by length/15. Looks OK without having played much with "15" as the reference,

If you want to play and optimise it, see line 1006 in psscale.c and mess with that.

two

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulWessel

PaulWessel commented Aug 29, 2023

Copy link
Copy Markdown
Contributor Author

@Esteban82 and @anbj might also have opinions on this scaling. Basically, while gmt modern mode with modern theme automatically scales the map fonts and thickness, but we never did this for color bars. Clearly a short bar cannot just use the default primary font size (12pm) so it does need its own separate scale.

Because this will look much bette without messing with FONT_ANNOT_PRIMARY etc I think we declare a bug.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulWessel
Update psscale.c
c160964
@PaulWessel

PaulWessel commented Aug 29, 2023

Copy link
Copy Markdown
Contributor Author

Maybe @seisman who initiated this issue has a comment on whether my sqrt of ratio to 15 cm looks good?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@anbj

anbj commented Aug 29, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Do not have very strong opinions about this. All plots and scaling in #6802 (comment) looks very nice to me. So go for it?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulWessel

PaulWessel commented Aug 30, 2023

Copy link
Copy Markdown
Contributor Author

@joa-quim is this an ok scaling?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulWessel
Merge branch 'master' into colorbar-unit
87aeb78
@joa-quim

joa-quim commented Aug 30, 2023

Copy link
Copy Markdown
Member

Yes, looks perfect.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulWessel

PaulWessel commented Aug 30, 2023

Copy link
Copy Markdown
Contributor Author

Yes, looks perfect.

OK, maybe an approval?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

joa-quim
joa-quim approved these changes Aug 30, 2023
View reviewed changes
seisman
seisman reviewed Aug 30, 2023
View reviewed changes
Comment thread src/psscale.c
GMT->current.setting.map_annot_offset[GMT_SECONDARY] *= scale_down;
GMT->current.setting.map_label_offset[GMT_X] *= scale_down;
GMT->current.setting.map_label_offset[GMT_Y] *= scale_down;
fprintf (stderr, "scale-down = %lg\n", scale_down);

@seisman seisman Aug 30, 2023

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should remove this fprintf or change it to GMT DEBUG MESSAGE:

Suggested change
fprintf (stderr, "scale-down = %lg\n", scale_down);
fprintf (stderr, "scale-down = %lg\n", scale_down);

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@seisman

seisman commented Aug 30, 2023

Copy link
Copy Markdown
Member

Update this colorbar-unit branch, build, and run this script. It simply uses a 15 cm bar for reference and then scales all parameters down by length/15. Looks OK without having played much with "15" as the reference,

If you want to play and optimise it, see line 1006 in psscale.c and mess with that.

two

Looks good to me.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PaulWessel
Update dvc files for 100 plots
bec9acd
@PaulWessel
PaulWessel merged commit 3f4d3b1 into master Aug 31, 2023
@PaulWessel
PaulWessel deleted the colorbar-unit branch August 31, 2023 11:35
@PaulWessel

PaulWessel commented Aug 31, 2023

Copy link
Copy Markdown
Contributor Author

FYI, this was merged, and the 100 new failures due to color bar font sizes etc were updated in DVC. So I am back to my 73 or so failures (mostly data related).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joa-quim

joa-quim commented Aug 31, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

DVC is giving more troubles than good. I wonder if we shouldn't simply create a separate git reportory with the PS's. And when it grows too much we just delete it and restart.

C:\progs_cygw\GMTdev\gmt5\master>dvc pull
  0% Querying remote cache|                                                     |0/128 [00:00<?,    ?files/s]Exception in thread fsspecIO:
Traceback (most recent call last):
  File "threading.py", line 1016, in _bootstrap_inner
  File "threading.py", line 953, in run
  File "asyncio\base_events.py", line 603, in run_forever
  File "asyncio\base_events.py", line 1871, in _run_once
  File "selectors.py", line 324, in select
  File "selectors.py", line 315, in _select
ValueError: too many file descriptors in select()

EDIT: 5 trials later, it worked.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joa-quim

joa-quim commented Aug 31, 2023

Copy link
Copy Markdown
Member

I'm having several failures like this

equalarea_diff

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@seisman seisman mentioned this pull request Sep 1, 2023
psscale: Convert a fprintf statement to GMT debug message #7774
Closed
@seisman seisman mentioned this pull request Sep 21, 2023
Fix lack of abs() in scale_down parameter in psscale #7816
Merged
@seisman seisman mentioned this pull request Jan 9, 2024
Update baseline images for grd2cpt, makecpt and subplot tests GenericMappingTools/pygmt#2977
Merged
@yvonnefroehlich yvonnefroehlich mentioned this pull request Aug 26, 2025
Colorbar annotation size does not change GenericMappingTools/pygmt#3041
Closed
@yvonnefroehlich yvonnefroehlich mentioned this pull request Sep 16, 2025
label font for colorbar is smaller than FONT_LABEL? #8796
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@seisman seisman seisman left review comments
@joa-quim joa-quim joa-quim approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@PaulWessel PaulWessel

Labels

bug Something isn't working

Projects

None yet

Milestone

6.5.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@PaulWessel @maxrjones @joa-quim @WalterHFSmith @remkos @seisman @anbj
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.