On Mon, 21 Mar 2005, Cathryn Meyer wrote:
> Hello,
>
> I have been trying to make a 6-panel plot that consists of two columns
> and three rows of plots. I want to label the x-axis of only the bottom
> two plots, however I can't seem to get this to work out! I am having
> the same problem with the legend - I only want it at the bottom of all
> six plots, not below each plot. However I can only get the legend to
> appear if I specify it when the first plot is made (and therefore it
> gets placed under the first plot), not if I specify it when the 6th plot
> is made. Why is this? How can I get around this?
Hi Cathryn,
In order for gsn_panel to work properly, it expects all of the plots
to be the same size. If you make one plot bigger than another, then
you will get unexpected results. The resizing of the panel plots is
based on the size of the first plot, so I'm guessing what's happening
in your case is that because your first plot is smaller, when it gets to
the 5th and 6th larger plots, the scale factor is wrong and the legend
ends up getting "clipped".
There are a few ways you can fix this. One way is to not use
gsn_panel, but instead resize the plots yourself using the vpXF, vpYF,
vpWidthF, and vpHeightF resources. You can use gsn_panel initially to
print out the values it's using for these four resources; you can then
start with these values and play with them until you get what you
want.
To get gsn_panel to print out its values, set:
pres1@gsnDebug = True
Once you have the vp resources values for each plot, you can
set them yourself, and don't call gsn_panel:
...
resources@gsnDraw = True ; This is True by default.
resources@gsnFrame = False ; Don't advance frame until we
; have drawn all six plots.
...
resources@vpXF = 0.1
resources@vpYF = 0.95
resources@vpWidthF = 0.3
resources@vpHeightF = 0.3
plots(0) = gsn_xy(wks,datatrop_E,lev,resources)
...
resources@vpXF = 0.55
resources@vpYF = 0.95
resources@vpWidthF = 0.3
resources@vpHeightF = 0.3
plots(1) = gsn_xy(wks,datatrop_E,lev,resources)
...
...
resources@vpXF = 0.1
resources@vpYF = 0.35
resources@vpWidthF = 0.3
resources@vpHeightF = 0.3
plots(5) = gsn_xy(wks,datatrop_E,lev,resources)
frame(wks)
--Mary
> The code I'm using to create the plots is:
>
> -----------------------------------------------------------------
> resources@tiMainString = "E Tropical"
> resources@tiMainFontHeightF = 0.04
> resources@trYReverse = True ; reverse Y-axis
> resources@tiYAxisString = "Pressure (mb)"
> resources@tiYAxisFontHeightF = 0.04
> resources@xyLineThicknesses = (/3.0,2.0,2.0,2.0,2.0/)
> resources@xyLineColors = (/"black","blue","red","blue","red"/)
> resources@xyDashPatterns = (/0.,0.,0.,16.0,16.0/)
> plots(0) = gsn_xy(wks,datatrop_E,lev,resources)
>
>
> resources@tiYAxisString = ""
> resources@tiMainString = "E Global"
> plots(1) = gsn_xy(wks,dataglobal_E,lev,resources)
>
>
> resources@tiYAxisString = "Pressure (mb)"
> resources@tiMainString = "AP0 Tropical"
> plots(2) = gsn_xy(wks,datatrop_AP0,lev,resources)
>
>
> resources@tiYAxisString = ""
> resources@tiMainString = "AP0 Global"
> plots(3) = gsn_xy(wks,dataglobal_AP0,lev,resources)
>
>
> resources@tiYAxisString = "Pressure (mb)"
> resources@tiXAxisOn = True ;turn on x axis
> resources@tiXAxisString = "Relative Humidity (%)"
> resources@tiXAxisFontHeightF = 0.04
> resources@tiMainString = "AP1 Tropical"
> plots(4) = gsn_xy(wks,datatrop_AP1,lev,resources)
>
>
> resources@pmLegendDisplayMode = "Always" ; turn on legend
> resources@xyExplicitLegendLabels =
> (/"Control","KEx2","KExhalf","warm","warm_KEx2"/)
> resources@tiYAxisString = ""
> resources@tiMainString = "AP1 Global"
> plots(5) = gsn_xy(wks,dataglobal_AP1,lev,resources)
>
> pres1 = True
> pres1@gsnFrame = False ; Don't advance the frame.
>
>
> gsn_panel(wks,plots,(/3,2/),pres1) ;Draw 3 rows and 2 columns of plots
> -----------------------------------------------------------------
>
> Thanks,
> Cathy
> --
> Cathryn Meyer
> Department of Geology and Geophysics
> Yale University
> cathryn.meyer@yale.edu
> (203)432-1959
> _______________________________________________
> ncl-talk mailing list
> ncl-talk@ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Mon Mar 21 2005 - 11:09:35 MST