Re: problem of setting tickmark in gsn_attach_plots

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue, 13 Dec 2005 10:02:05 -0700 (MST)

On Tue, 13 Dec 2005, S. Yi wrote:

> Hello,
>
> I have four plots ,e.g. plotTopL, plotTopR, plotBotL, and plotBotR,
> and want to put them in a 2 X 2 layout.
>
> ------------------------------------------------
> ; for top row
> tbs = True;
> tas = True
> newplot1 = gsn_attach_plots(plotTopL, plotTopR, tbs, tas)
>
> ; for bot row
> bbs = True;
> bas2 = True
> newplot2 = gsn_attach_plots(plotBotL, plotBotR, tbs, tas)
>
> ; combine them together
> bs = True
> as = True
> bs_at_gsnAttachPlotsXAxis = True
> newplot = gsn_attach_plots(plotTopL, plotBotL, bs, as)
>
> draw(plotTopL)
> frame(wks)
>
> --------------------------------
> However, there are tickmarks and labels for XB axis of plotTopR, and
> tickmarks for XT axis of plotBotR. I can turn off the labels, but
> cannot turn off the tickmarks. (There is no tickmark on XB axis of
> plotTopL and XT axis of plotBotL)
>
> My question is how to turn the tickmarks off, so that plots look
> consistent.
>
> Thanks.
>
> Yi, Shuhua
> School of Geography and Earth Sciences
> McMaster University
> Hamilton, ON, CA L8S 4K1

Hi,

I believe the gsn_attach_plots function is not set up to recognize the
case where two sets of attached plots are being attached to each
other. It appears that it only sees the base plots in the list
(plotTopL and plotBotL in this case), and turns off only the tickmarks
for these two.

I'll look into this, but meanwhile, I think all you need to do is
turn off the bottom tickmarks for the top two plots, and the top
tickmarks for the bottom two plots.

Here's a complete example you can try:

======================================================================

load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_csm.ncl"

begin
;
; Generate some dummy data.
;
   data = random_uniform(-10,10,(/4,12/))
   x = ispan(0,11,1)

;
; Open a workstation.
;
   wks = gsn_open_wks("x11","test")

;
; Set some resources.
;
   res = True
   res_at_gsnDraw = False
   res_at_gsnFrame = False

;
; Turn off bottom tickmarks and labels.
;
   res_at_tmXBOn = False

;
; Create top two plots.
;
   plotTopL = gsn_csm_xy(wks,x,data(0,:),res)
   plotTopR = gsn_csm_xy(wks,x,data(1,:),res)

;
; Leave on bottom tickmarks and labels, but turn
; off top tickmarks and lables.
;
   delete(res_at_tmXBOn)
   res_at_tmXTOn = False

;
; Create bottom two plots.
;
   plotBotL = gsn_csm_xy(wks,x,data(2,:),res)
   plotBotR = gsn_csm_xy(wks,x,data(3,:),res)

;
; Attach top two plots along the Y axis.
;
   resTopL = True
   resTopR = True

   newplot1 = gsn_attach_plots(plotTopL,plotTopR,resTopL,resTopR)
   draw(plotTopL)
   frame(wks)

;
; Attach bottom two plots along the Y axis.
;
   resBotL = True
   resBotR = True
   newplot2 = gsn_attach_plots(plotBotL, plotBotR, resBotL, resBotR)

   draw(plotBotL)
   frame(wks)

;
; Combine them together.
;
   resTop = True
   resBot = True
   resTop_at_gsnAttachPlotsXAxis = True
   newplot = gsn_attach_plots(plotTopL, plotBotL, resTop, resBot)

   draw(plotTopL)
   frame(wks)
end

======================================================================

--Mary
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Dec 13 2005 - 10:02:05 MST

This archive was generated by hypermail 2.2.0 : Tue Dec 13 2005 - 10:31:16 MST