Re: plot and page size

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri, 15 Jun 2007 12:26:15 -0600 (MDT)

On Fri, 15 Jun 2007, Dan Barrie wrote:

> Dear ncl users:
>
> The archives detail a great deal of discussion regarding the gsn resources,
> particularly the ones that pertain to page size/ plot maximization. Despite
> all the talk on this matter, I'm still having a lingering, yet simple issue
> with my .ps files and their orientation. Using only the resource function
> gsnMaximize, my plot is fitted to the postscript sheet. However, it is then
> oriented sideways on my screen. I understand that you can then use the
> function gsnPaperOrientation to set the sheet to a portrait orientation, but
> then there is a huge white area both above and below my plot filling the rest
> of the page, which eliminates the alteration performed by the gsnMaximize
> function. I have tried using the gsnPaperWidth and gsnPaperHeight functions
> to alter this large whitespace, but they do not seem to work. It's at this
> point that the archived discussion doesn't help address this issue. Can
> anyone help? I would rather not use some secondary software package (ie
> imagemagick) to rotate the image, since it often leads to resolution
> reductions. Thanks!
>
> -Dan

Hi Dan,

As you saw, if you have an image that is wider than it is high, *and*
gsnMaximize is set to True, then the image will be rotated (for PS or PDF
formats) in order to make even better use of the size of the page.

Setting gsnMaximize to True will also ensure that the aspect ratio of
your plot doesn't change. So, if you take a plot that is wider than it
is high, but you plot it in portrait mode on a paper that is higher
than it is wide, you will get white space above and below the plot, no
matter what you do.

If I understand you correctly, it sounds like you want to skew the
shape of your plot so that it better fits the page in landscape mode?
If so, you can do this by setting res_at_mpShapeMode to "FreeAspect", and
then set res_at_vpHeightF and res_at_vpWidthF to something like 0.8. I've
attached a simple script as an example.

Let me know if this isn't what you want.

--Mary

>
>
>
>
> ;*************************************************
> ; ce_3.ncl
> ;************************************************
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load
> "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load
> "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> ;************************************************
>
> begin
>
> ;************************************************
> ; open file and read in data
> ;************************************************
>
> in1 =
> addfile("/data/sv3/dbarrie/db008.01/db008.01.cam2.h1.0000-09-01-00000.nc","r")
> in2 =
> addfile("/data/sv3/dbarrie/db008.02/db008.02.cam2.h1.0000-09-01-00000.nc","r")
>
> do i=1,72,1
>
> SLP1 = in1->PSL(i,:,:)
> SLP2 = in2->PSL(i,:,:)
>
> ;************************************************
> ; make differences
> ;************************************************
> SLP = SLP2 - SLP1
> copy_VarCoords(SLP1,SLP)
> copy_VarAtts(SLP1,SLP)
>
> ;************************************************
> ; create plot
> ;************************************************
>
> if (i .lt. 10)
> wks = gsn_open_wks("ps" ,"timeseries0"+i+"")
> else
> wks = gsn_open_wks("ps" ,"timeseries"+i+"")
> end if
> print(i)
>
> gsn_define_colormap(wks,"BlAqGrYeOrRe") ; choose colormap
>
> res = True ; plot mods desired
> res_at_gsnMaximize = True ; Fill entire ps plot space
> res_at_gsnPaperOrientation = "portrait" ; Choose orientation
> res_at_gsnPaperWidth = 9 ; Specify ps document width
> res_at_gsnPaperHeight = 4 ; Specify ps document height
> res_at_cnFillOn = True ; turn on color fill
> res_at_cnLinesOn = False ; turn of contour lines
> res_at_cnLevelSelectionMode = "ManualLevels" ;turn on manual range
> res_at_cnMinLevelValF = -5.0 ; minimum of range
> res_at_cnMaxLevelValF = 5 ; maximum of range
> res_at_cnLevelSpacingF = 0.5 ; contour spacing
> res_at_gsnSpreadColors = True ; use full range of color map
> res_at_lbLabelStride = 4
>
>
> res_at_pmTickMarkDisplayMode = "Always"; use NCL default lat/lon labels
>
> res_at_gsnAddCyclic = False ; data already has cyclic point
> ; this must also be set for any zoom
>
> ; note that the gsn_csm_*map_ce templates automatically set
> ; res_at_mpLimitMode="LatLon" for you. If you are plotting a different
> projection,
> ; you may have to set this resource.
>
> ; res_at_mpMinLatF = -60 ; range to zoom in on
> ; res_at_mpMaxLatF = 30.
> ; res_at_mpMinLonF = 30.
> ; res_at_mpMaxLonF = 120.
>
> plot = gsn_csm_contour_map_ce(wks, SLP, res)
> ;************************************************
>
> end do
>
> end
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Fri Jun 15 2007 - 12:26:15 MDT

This archive was generated by hypermail 2.2.0 : Fri Jun 15 2007 - 12:34:56 MDT