Re: a question of usage of gsn_panel

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue, 5 Feb 2008 21:26:12 -0700

Yinghui,

Sorry I didn't answer your question correctly before. By default, NCL
draws plots to a square (unless you are drawing to a non-square map
projection).

If you want your plots to be wider in the X direction, then you can set
the viewport resources "vpHeightF" and "vpWidthF" to values between 0
and 1 to indicate what kind of width-to-height ratio you want. It
doesn't matter what values you use, as long as the ratio is correct,
because gsn_panel is going to resize them anyway and the ratio will be
preserved.

So, for example, if you want your plot width to be 3 times as wide as
the height, then you could set:

    res_at_vpWidthF = 0.90
    res_at_vpHeightF = 0.30

For a full resizing and paneling example, see example 2 at:

http://www.ncl.ucar.edu/Applications/tickmarks.shtml

--Mary

On Feb 5, 2008, at 5:29 PM, Yinghui Liu wrote:

> Thanks, Mary.
>
> I intended to put the five figures in 5 rows, with each figure with
> larger size
> in X direction than in Y direction. But it turned out the both
> directions have
> same size. What did I do wrong?
>
> Yinghui
>
>
> Mary Haley wrote:
>>
>> Yinghui,
>>
>> The third argument to gsn_panel is supposed to indicate # rows by # of
>> columns. Since you are using (/5,1/), this will give you 5 rows by 1
>> columns. Try using (/1,5/) instead, to get 1 row by 5 columns.
>>
>> --Mary
>>
>> On Tue, 5 Feb 2008, Yinghui Liu wrote:
>>
>>> Hi, all:
>>>
>>> I am trying to use gsn_panel to plot five figures in one page in 5
>>> rows.
>>> My program is below. My question is why the five figures squeezed
>>> at the center, not extending from the left to the page to the right?
>>> The figure is attached.
>>>
>>> Thanks,
>>>
>>> Yinghui Liu
>>>
>>> wks = gsn_open_wks("ps","streamfunction")
>>>
>>> res = True
>>> res_at_gsnFrame = False
>>> res_at_gsnDraw = False
>>>
>>> res_at_cnInfoLabelOn = False
>>>
>>> res_at_cnLevelSpacingF = 2.0 ; contour level
>>> spacing
>>> res_at_gsnContourZeroLineThicknessF = 1. ; doubles
>>> thickness of zero contour
>>> res_at_gsnContourNegLineDashPattern = 1 ; sets negative
>>> contours to dash pattern 1
>>> res_at_trYMinF = 100.
>>>
>>> plot = new(5,graphic)
>>>
>>> res_at_tiMainString = "Annual mean"
>>> plot(0) = gsn_csm_pres_hgt(wks,m_year,res)
>>>
>>> res_at_tiMainString = "Winter mean (DJF)"
>>> plot(1) = gsn_csm_pres_hgt(wks,m_winter,res)
>>>
>>> res_at_tiMainString = "Spring mean (MAM)"
>>> res_at_trYMinF = 100.
>>> plot(2) = gsn_csm_pres_hgt(wks,m_spring,res)
>>>
>>> res_at_tiMainString = "Summer mean (JJA)"
>>> plot(3) = gsn_csm_pres_hgt(wks,m_summer,res)
>>>
>>> res_at_tiMainString = "Autumn mean (SON)"
>>> plot(4) = gsn_csm_pres_hgt(wks,m_autumn,res)
>>>
>>> gsn_panel(wks,plot,(/5,1/),False) ; create panel plot
>>>
>>>
>>>
>

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Feb 05 2008 - 21:26:12 MST

This archive was generated by hypermail 2.2.0 : Tue Feb 05 2008 - 21:51:46 MST