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 inset begin accept -R and -J to automatically set width or height #5875

Closed
maxrjones opened this issue Oct 18, 2021 · 5 comments
Closed
Labels
feature request Request a new feature

Comments

@maxrjones
Copy link
Member

maxrjones commented Oct 18, 2021

Description of the desired feature

Currently, the user must use mapproject to determine the appropriate size for a inset to match a given region and projection. It would be useful to allow inset begin to accept the region and projection of the inset, similar to subplot begin, to avoid this extra step. Here is an example of the anticipated usage:

gmt begin test png
    gmt grdimage @earth_relief -R-51/-48/-24/-23 -JM15c -B -Cworld
    gmt inset begin -DjBL+o0.1c -F+p1p,black -R-80/-28/-43/10 -JM2c
        gmt coast -Wthin -Swhite -Ggray 
    gmt inset end
gmt end show

expected output

Are you willing to help implement and maintain this feature? Yes

@PaulWessel
Copy link
Member

This is not a bug (it is a feature): The user is specifying a 2cx2c inset and requests a Mercator plot for some region. The dimension of that map is

gmt mapproject -R-80/-28/-43/10 -JM2c -W
2	2.20926717722

so -JM? finds that it needs to use a width of 2 * (2/2.20926717722) to fit inside the box. Now, I understand this is inconvenient and perhaps we can improve this, but the solution would be to ask for +w2c/2.20926717722c:

test

I guess one possible way to deal with this is to specify +w2c/0 and let GMT compute what height needs to be based on the -R -J but that is not yet known when gmt inset begin starts. Will need to think about this a bit. Feel free to turn this "lesson" into a feature request, for instance.

@maxrjones
Copy link
Member Author

Could inset begin accept -J and -R similar to subplot begin in order to make this easier for the user?

@maxrjones maxrjones changed the title Inset size not correctly adjusted for region Let inset adjust size for a given region and projection Oct 18, 2021
@maxrjones maxrjones added feature request Request a new feature and removed bug Something isn't working labels Oct 18, 2021
@PaulWessel
Copy link
Member

PaulWessel commented Oct 18, 2021 via email

@maxrjones maxrjones changed the title Let inset adjust size for a given region and projection Let inset begin accept -R and -J to automatically set width or height Oct 19, 2021
@maxrjones
Copy link
Member Author

Yes, possibly. Please make a feature request and include that suggestion.

OK, I have adjusted this issue to be a feature request rather than a bug report and detailed the suggested feature in the main post.

PaulWessel added a commit that referenced this issue Oct 25, 2021
See #5875 for background.  This PR implements that suggestion and adds a new test inset2.sh to demonstrate it.
PaulWessel added a commit that referenced this issue Nov 1, 2021
… of via -D (#5903)

* Let inset begin take -R -J to determine inset size

See #5875 for background.  This PR implements that suggestion and adds a new test inset2.sh to demonstrate it.

* Create inset2.ps

Add original for inset2.sh test

* Update inset.c

* Clarify margin units
@PaulWessel
Copy link
Member

OK, to close this issue, @meghanrjones ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request a new feature
Projects
None yet
Development

No branches or pull requests

2 participants