Skip to content

Conversation

@PaulWessel
Copy link
Member

@PaulWessel PaulWessel commented Sep 17, 2021

If either of these are given in percentages then their values replace the default percentage values of 80% and 5% for length and width, respectively. I have added this information to the usage and documentation, and added a test script that tries various combination of percentages and actual dimensions:

gmt begin scale_percent ps
        gmt makecpt -Cturbo -T0/10
        gmt basemap -R0/10/0/10 -JX15c -B
        gmt colorbar -DJTC+w40%/15% -B
        gmt colorbar -DJML+w9c/5% -B
        gmt colorbar -DJMR+w80%/0.6c -B
        gmt colorbar -DJBC+w70% -B
gmt end show

which yields

scale_percent

Closes #5771.

If either of these has percentages then the value replace the default percentages values of 80% and 5% for length and width, respectively.
This replaces the default values of 80% and 4% for length and width, respectively.
@PaulWessel PaulWessel self-assigned this Sep 17, 2021
@PaulWessel PaulWessel added the enhancement Improving an existing feature label Sep 17, 2021
@Esteban82
Copy link
Member

I have a problem with gmt colorbar -DJML+w9c/5% -B

scale_percent

@Esteban82
Copy link
Member

I get the same width with 1% or 100%.

gmt begin scale_percent png
        gmt makecpt -Cturbo -T0/10
        gmt basemap -R0/10/0/10 -JX2/10c
        gmt colorbar -DjML+w9c/1% -B
        gmt colorbar -DjMR+w9c/100% -B
gmt end show

scale_percent

@PaulWessel
Copy link
Member Author

Strange that I dont get that. So it happens when the first (length) argument is a dimension and the second (width) is a percentage? Is that the only combination that fails?

@Esteban82
Copy link
Member

Yes, only that combination.

@PaulWessel
Copy link
Member Author

I am testing anim08 on the tempfile_fix branch so it will take an hour before I can switch...

@PaulWessel
Copy link
Member Author

OK, should be better now - please try again.

Copy link
Member

@Esteban82 Esteban82 left a comment

Choose a reason for hiding this comment

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

Now it works.

@maxrjones maxrjones added the add-changelog Add PR to the changelog label Sep 17, 2021
Copy link
Member

@maxrjones maxrjones left a comment

Choose a reason for hiding this comment

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

Very nice!

Co-authored-by: Meghan Jones <meghanj@alum.mit.edu>
@PaulWessel PaulWessel merged commit c2b5bae into master Sep 17, 2021
@PaulWessel PaulWessel deleted the percent-handling branch September 17, 2021 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-changelog Add PR to the changelog enhancement Improving an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

colorbar length as a percentage relative to a map side

4 participants