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

Modern mode: specify paper size and not cropping the figure #106

Closed
seisman opened this issue Oct 1, 2018 · 13 comments
Closed

Modern mode: specify paper size and not cropping the figure #106

seisman opened this issue Oct 1, 2018 · 13 comments

Comments

@seisman
Copy link
Member

seisman commented Oct 1, 2018

In modern mode, figures are by default cropped to the minimum required by the image contents, using psconvert -A.

Sometimes, we may want to plot a figure on A4 paper for printing. In this case, we need to specify paper size and set psconvert to not crop the figure.

This is what I try:

gmt begin map png
gmt set PS_MEDIA=A4 PS_CONVERT=""
gmt basemap -R0/10/0/10 -JX10c -Bafg 
gmt end

map
However, you'll see that the right part of the figure is missing. It seems that the origins for the plot are somehow in the middle of the paper, different from the behavior in classic mode. Is it desired or a bug?

@PaulWessel
Copy link
Member

Hm, I print PDF figures all the time. The printer knows its paper size and off it goes. I can even scale the figure if I want to or let it be exactly as is. it tends to center the figure on the paper. Anyway, what you got is probably not what we want but I think you are trying to defeat how GMT is doing things.

@seisman
Copy link
Member Author

seisman commented Oct 1, 2018

Now I understand why GMT tends to center the figure on the paper in modern mode.

I once thought that following codes should work.

gmt begin map png 
gmt set PS_MEDIA=A4 PS_CONVERT="" MAP_ORIGIN_X=2i MAP_ORIGIN_Y=2i
gmt basemap -R0/10/0/10 -JX10c -Bafg 
gmt end

However, the plot is still not at the lower left corner of the paper. Why does basemap ignore MAP_ORIGIN_X and MAP_ORIGIN_Y?

@joa-quim
Copy link
Member

joa-quim commented Oct 1, 2018

I've not tested the modern mode much on Win and suspect there are issues in it. Just to check, do you also get this error?

gmt basemap -R0/10/0/10 -JX10c -Bafg --PS_MEDIA=A4 --PS_CONVERT="" --MAP_ORIGIN_X=2i --MAP_ORIGIN_Y=2i map pdf
gmt [ERROR]: Shared GMT module not found: basemap

@seisman
Copy link
Member Author

seisman commented Oct 1, 2018

@joa-quim I think the correct one-line command should be:

gmt basemap -R0/10/0/10 -JX10c -Bafg --PS_MEDIA=A4 --PS_CONVERT="" --MAP_ORIGIN_X=2i --MAP_ORIGIN_Y=2i -pdf map

Please note the dash symbol before pdf.

@PaulWessel
Copy link
Member

Note this gives what you want but PS:

gmt basemap -R0/10/0/10 -JX10c -Bafg --PS_MEDIA=A4 --PS_CONVERT="" --MAP_ORIGIN_X=2i --MAP_ORIGIN_Y=2i -ps map

@joa-quim
Copy link
Member

joa-quim commented Oct 1, 2018

Right. You can see that have not been practicing modernity. But it respects the X,Y origin. I mean, origin is at 2,2 inch

@seisman
Copy link
Member Author

seisman commented Oct 1, 2018

Two solutions I just find.

gmt begin map ps
gmt basemap -R0/10/0/10 -JX10c -Bafg 
gmt end
gmt psconvert map.ps -P -Tf
gmt begin map pdf
gmt set PS_MEDIA=A4 PS_CONVERT="" 
gmt basemap -R0/10/0/10 -JX10c -Bafg -X1i -Y1i 
gmt end

@joa-quim
Copy link
Member

joa-quim commented Oct 1, 2018

Sorry, don't get what is the problem. These both work as intended

gmt basemap -R0/10/0/10 -JX10c -Bafg --PS_MEDIA=A4 --PS_CONVERT="" -X1i -Y1i -pdf map

gmt basemap -R0/10/0/10 -JX10c -Bafg --PS_MEDIA=A4 -X1i -Y1i -ps map

@PaulWessel
Copy link
Member

Try MAP_ORIGIN_X|Y instead...

@seisman
Copy link
Member Author

seisman commented Oct 2, 2018

MAP_ORIGIN_X and MAP_ORIGIN_Y don't work because they only works for a new plot. For an overlay, the default offset is always zero.

@stale
Copy link

stale bot commented Jan 23, 2019

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@stale stale bot added the stale This will not be worked on label Jan 23, 2019
@leouieda
Copy link
Member

@seisman any update on this issue?

@stale stale bot removed the stale This will not be worked on label Jan 24, 2019
@seisman
Copy link
Member Author

seisman commented Jan 24, 2019

Close this issue, since I've found two solutions.

@seisman seisman closed this as completed Jan 24, 2019
obaney pushed a commit to obaney/gmt that referenced this issue Aug 18, 2021
Missing aliases and more extensive documentation and tests.
Defines the new `gmt/modules.py` file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants