For some reason, having a gmt.conf file with PS_MEDIA=letter set before calling gmt begin to start modern mode causes with the -Xc flag. commenting out gmt set PS_MEDIA letter removes the issue, as does putting gmt set within the begin command. I tested a few other gmt set options and PS_MEDIA was the only one that did this.
Thoughts?
#!/bin/bash
rm -f gmt.conf gmt.history
gmt set PS_MEDIA letter
gmt begin test1 ps
gmt basemap -R0/1/0/1 -JX4i -Baf -Xc
gmt end
gmt begin test2 ps -C
gmt basemap -R0/1/0/1 -JX4i -Baf -Xc
gmt end
gmt begin test3 ps -C
gmt set PS_MEDIA letter
gmt basemap -R0/1/0/1 -JX4i -Baf -Xc
gmt end
This is intended behavior. Since GenericMappingTools/gmt#4735, modern mode ignores any PS_MEDIA set before gmt begin, because modern plots use an auto-cropped canvas. -Xc/-Xf need a fixed page, so set it inside the session:
gmt begin test1 ps
gmt set PS_MEDIA letter
gmt basemap -R0/1/0/1 -JX4i -Baf -Xc
gmt end
The explanation that modern mode ignores a pre-session PS_MEDIA makes sense of why test2 and test3 work while test1 fails, since -Xc needs a fixed page rather than the auto-cropped canvas. One thing I’m still unsure about: does putting gmt set PS_MEDIA letter inside the begin block override the auto-crop for that session only, or does it carry over to any later begin in the same script? Your working example suggests the former. If so, that’s probably worth a short note in the docs for -Xc/-Xf, since the silent ignore before begin is easy to trip over.