Re: Question about the TickMark resources and the changes of viewport width.

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Sun Nov 15 2009 - 19:36:00 MST

Dear Huang Ping,

It may not be easy to find, but the documentation on the TickMark
resource page states that the tickmark lengths change when the
viewport is resized, unless you set the tmXB/YLMajorLengthF
resources. For example:

    tmXBMajorLengthF - Sets the length of the X-Axis bottom major
tick marks in NDC coordinates. This length scales with changes to the
viewport height, unless you explicitly set tmXBMajorLengthF at the
same time.

There are two ways you can set these resources, then. You can set the
tmXBMajorLengthF, tmXBMinorLengthF, tmXBMajorOutwardLengthF, and
tmXBMinorOutwardLengthF resources (and same for the YL resources) to
fixed values, or you can go ahead and create the plot, retrieve the
values used for these resources, and then set them along with when
you resize the viewport.

Please see the attached "tm1.ncl" script for an example of how to
retrieve and then set these resources values, and the "tm2.ncl"
script for an example of how to set them up front.

As for why your script below was behaving differently, I'm not sure.
I would have to see the whole script to make sure other resources
weren't being set that might affect the tickmark lengths, like
"gsnMaximize".

--Mary

On Nov 14, 2009, at 10:42 PM, 黄平 wrote:

> Hi, all
>
> A lot of TickMark (tm) resources' values scales proportionally to
> changes in the width of the viewport. Sometime, I need to reduce
> the viewport height of the plot for puting several plot into one
> panel using gsn_panel() and keep the default values (for a viewport
> width of 0.6) of the tickmark objects. How to cutoff the connection
> between TickMark and viewport?
>
> Confusely, there are some different cases about the connection
> between TickMark and viewport.
>
> ;-----------------------------------------------------------
> Case 1. set the vpWidthF before plot:
>
> res = True
> res@vpWidthF = 0.3
>
> plot1 = gsn........ ;first plot with res
> plot2 = gsn........ ; second plot with res
> ......
>
> All the TickMark of plots change with viewport Width 0.3.
>
> ;-----------------------------------------------------------
>
> Case 2. set the vpWidthF after one plot:
>
> res = True
>
> plot1 = gsn........ ;first plot with res
> res@vpWidthF = 0.3
> plot2 = gsn........ ; second plot with res
> ......
>
> Of course, the tickmarks of plot1 is proportional to the default
> vpWidthF 0.6. But the tickmarks of the plot2 do not change with the
> vpWidthF 0.3!
>
> ;----------------------------------------------------------------
>
> Case 3. set the vpWidthF before one plot and change vpWidthF again
> after this plot :
>
> res = True
> res@vpWidthF = 0.5
> plot1 = gsn........ ;first plot with res
> res@vpWidthF = 0.3
> plot2 = gsn........ ; second plot with res
> ......
>
> First, the tickmarks of plot1 reduce with the changes of vpWidthF
> = 0.5 like the case 1. But the tickmarks of the plot2 reduce with
> the changes of the vpWidthF 0.3 too. This is not like the case 2.
>
> ;------------------------------------------------------------------
>
> So I have to add a unneccessary plot befor setting vpWidthF as case
> 2 to keep proper tickmark sizes and viewport height in the plot2
> and hereafters.
>
> I am very confused with these three cases. Could anyone explain
> these cases and give a proper setting to cutoff the connection
> between tickmark and viewport?
>
> Best regards.
>
> Huang Ping
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Nov 15 19:36:12 2009

This archive was generated by hypermail 2.1.8 : Tue Nov 17 2009 - 17:27:42 MST