Skip to content
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

Let pslegend -D+w accept a percentage relative to map width #7909

Merged
merged 2 commits into from Oct 17, 2023

Conversation

PaulWessel
Copy link
Member

Similar to psscale, allow processing of things like +w80%. This PR implements this via a new gmt function gmt_rectangle_dimension that does the parsing, hence the PR involves psscale as well as some library and include files.

@Esteban82, All tests pass as before, but I have not tested this specifically with legend. Please give it a try. +w90% will set width to 90% of map width, while +w90%/30% will fix height at 30% of the legend width (not map width).

Similar to psscale, allow processing of things like +w80%.  This PR implements this via a new gmt function that does the parsing, hence the PR involves psscale as well as some library and include files.
@PaulWessel PaulWessel added the enhancement Improving an existing feature label Oct 15, 2023
@PaulWessel PaulWessel added this to the 6.5.0 milestone Oct 15, 2023
@PaulWessel PaulWessel self-assigned this Oct 15, 2023
@Esteban82
Copy link
Member

Thanks Paul!!

I'm affraid that is not working. I try the script below and I didn't get any legend and this message:
legend [ERROR]: Must specify -D...+w<width> if more than one symbol column (N = 5)

Full script

gmt begin GMT_earth_mask png
	gmt set GMT_THEME cookbook GMT_DATA_SERVER candidate
	gmt makecpt -Clightblue,burlywood,blue,red,white -T-0.5/4.5/1 -N
	gmt grdimage @earth_mask_05m -JQ0/15c
	gmt legend -DJBC+w90%+o0/0.05c -F+p1p <<- EOF
	N 5
	S - s 0.5c lightblue 0.25p - Ocean [0]
	S - s 0.5c burlywood 0.25p - Land [1]
	S - s 0.5c blue 0.25p - Lake [2]
	S - s 0.5c red 0.25p - Island [3]
	S - s 0.5c white 0.25p - Pond [4]
	EOF
gmt end

If a remove the line N 5, them it works but it is not the legend that I want.

GMT_earth_mask

@PaulWessel
Copy link
Member Author

Shit, in modern mode the command has no -R -J and when that check comes it has not yet set them from hidden file... I will check. If you just try a classic case it should work.

@PaulWessel
Copy link
Member Author

Just a dump 1 line error. Now rows I think (your script runs for me)

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.

@Esteban82 Esteban82 merged commit c15b21d into master Oct 17, 2023
6 checks passed
@Esteban82 Esteban82 deleted the legend-percent-width branch October 17, 2023 02:37
@Esteban82 Esteban82 added the add-changelog Add PR to the changelog label Oct 17, 2023
@Esteban82
Copy link
Member

I took the liberty of adding the label "add-changelog".

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.

None yet

2 participants