Re: fixed map positioning on the paper sheet

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu, 12 Mar 2009 11:23:10 -0600 (MDT)


First of all, you won't be able to use gsnMaximize because this
resource causes each map to be as large as possible without regard to
where it goes on the page.

If you want to control exactly where the map falls on the page,
then first use the vpXF and vpYF resources to control the location
of the upper left corner of the plot, *and* make sure gsnMaximize
is not set:

; res_at_gsnMaximize = True
   res_at_vpXF = 0.1
   res_at_vpYF = 0.9

You can also set the width and height:

   res_at_vpWidthF = 0.8
   res_at_vpHeightF = 0.8

Note that even though I've made the width and height a square, NCL
will preserve the aspect ratio of the map, unless the resource
mpShapeMode is set to "FreeAspect".

If you further want to make the plot bigger in the PS file, you will
need to use the special PS device coordinates. You set these when you
create the workstation:

   type = "ps"
   type_at_wkDeviceUpperX = 650
   type_at_wkDeviceUpperY = 600
   type_at_wkDeviceLowerX = 0
   type_at_wkDeviceLowerY = 20

   wks = gsn_open_wks(type, "map")

It's a pain figuring out what to set these resources to, but again,
regardless of what you set them to, the aspect ratio of your plot will
be preserved.

There's an unadvertised feature to help with the device coordinates.

First, run your program with:

   res_at_gsnMaximize = True
   res_at_gsnDebug = True

This will output the values that it used for the four device
coordinates when the plot is maximized on the PS page. You can then
use these to help you determine what to use in your own program.
(Be sure to comment out these resources when you're done using them
for debug purposes.)

I've attached a sample script to see how this works. Try commenting
out the setting of the four device coordinates, and uncommenting the
gsnMaximize and gsnDebug resources to see what happens.


On Thu, 12 Mar 2009, Patrick Reuter wrote:

> Dear all,
> I have a concern when creating NCL maps in similar size for different
> variables and areas: actually, I would like that my map has always the
> same paper width, so that the left top corner and the right top corner
> are always at the same location of the paper sheet. Only the height of
> the map should change, so that it respects the aspect ratio.
> I would need this information in order to crop fixed-size images. What
> happens with gsnMaximize is that whenever the variable changes, there
> is a lot of rearrangement in the page according to the values of the
> longitude/latitude, or the legend, so that I have to crop every single
> map independently.
> Hope I was clear ;-)
> Thank you all!
> Patrick
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:

Received on Thu Mar 12 2009 - 11:23:10 MDT

This archive was generated by hypermail 2.2.0 : Thu Mar 12 2009 - 14:10:21 MDT