[ncl-talk] problems with legends side-by-side.

Karin Meier-Fleischer meier-fleischer at dkrz.de
Mon Mar 30 12:48:50 MDT 2015


Hi Vanucia,

example xy_32.nxl is what you are looking for. It should work, but without your complete script I can show you only how it can be:

…


;-- set resources
  res               =  True
  res at gsnDraw       =  False
  res at gsnFrame      =  False
  res at gsnMaximize   =  True
  
  res at vpWidthF      =  0.8        ; Make plots wider
  res at vpHeightF     =  0.6
  
  res at trYMinF       =  min(zave1)
  res at trYMaxF       =  max(zave1)

  res at pmLegendDisplayMode    = "Always"              ; turn on legend
  res at pmLegendWidthF         =  0.12                 ; Change width and
  res at pmLegendHeightF        =  0.15                 ; height of legend.
  res at lgLabelFontHeightF     =  0.011                ; change font height
  res at lgPerimOn              = False                 ; no box around
 
  res at tmXTOn                 = False    ; bottom off
  res at tmYROn                 = False    ; right off
  
  res at xyMonoDashPattern      = True     ; force all solid lines

;-- assign plot array
  plot    =  new(7,graphic)

;-- define colors, labels, line thickness and legend position
  colors  =  (/"blue","red","brown","purple","green","orange","black"/)
  labels  =  (/"  BCC-CSM1.1","  CanCM4","  CCSM4","  CFSv2-2011","  CMCC-CM","  FGOALS-G2.0","  CFSR"/)
  lt      =  (/5.0,5.0,5.0,5.,5.,5.,9./)  
  lposx    =  (/.15, .37, .61, .81, .14, .39, .60/)
  lposy    =  (/.10, .10, .10, .10, .15, .15, .15/)

;-- create the plots
  do i=0,6
     res at xyLineColors           =  colors(i)
     res at xyExplicitLegendLabels =  labels(i)
     res at xyLineThicknessF       =  lt(i)
     res at pmLegendParallelPosF   =  lposx(i)
     res at pmLegendOrthogonalPosF =  lposy(i)
     plot(i) = gsn_csm_xy(wks,x,zave1(i,:),res)
  end do

;-- overlay the plots
  overlay(plot(0),plot(1))
  overlay(plot(0),plot(2))
  overlay(plot(0),plot(3))
  overlay(plot(0),plot(4))
  overlay(plot(0),plot(5))
  overlay(plot(0),plot(6))

;-- draw the plots
  draw(plot(0))
  frame(wks)



Bye, 
Karin

Am 30.03.2015 um 19:33 schrieb Vanúcia Schumacher <vanucia-schumacher at hotmail.com>:

> Sorry, I forgot to include the script, below:
> 
>  zave1 = new ((/7,dimsizes(zave&lat)/), float)
>   zave1(0,:) = zave(0,0,:)
>   zave1(1,:) = zave(1,0,:)
>   zave1(2,:) = zave(2,0,:)
>   zave1(3,:) = zave(3,0,:)
>   zave1(4,:) = zave(4,0,:)
>   zave1(5,:) = zave(5,0,:)
>   zave1(6,:) = zave(6,0,:)
>  
> printVarSummary( zave1) 
> ;************************************************
> ; plot
> ;************************************************
>    wks  = gsn_open_wks("png","ts.zonal.labels1")           
>  
> ;---Plotting options for time series plot
>   res             = True
> 
>   res at gsnMaximize = True
>   res at vpWidthF      = 0.8        ; Make plots wider
>   res at vpHeightF     = 0.6
>   res at trYMinF     = min(zave)
>   res at trYMaxF     = max(zave)
> 
> ;---Resources for legend
> 
>   res at pmLegendDisplayMode    = "Always"              ; turn on legend
>   res at pmLegendWidthF         = 0.12                 ; Change width and
>   res at pmLegendHeightF        = 0.15                  ; height of legend.
>   res at pmLegendOrthogonalPosF = -0.10                ; move up slightly 
>   res at lgLabelFontHeightF     = .011                  ; change font height
>   res at lgPerimOn              = False                 ; no box around
>  
> ;---Turn off some tickmarks
>   res at tmXTOn                 = False    ; bottom off
>   res at tmYROn                 = False    ; right off
> 
>   
> ;---Create the four XY plots
> 
>    res at xyExplicitLegendLabels  = (/"BCC-CSM1.1","CanCM4","CCSM4","CFSv2-2011","CMCC-CM","FGOALS-G2.0","CFSR"/)
>    res at pmLegendParallelPosF    = 0.15
>    res at xyMonoDashPattern       = True     ; force all solid lines
>    res at xyLineColors            = (/"blue","red","brown","purple","green","orange","black"/)
>    res at xyLineThicknesses       = (/5.0,5.0,5.0,5.,5.,5.,9./)  
>      
>    plot1 = gsn_csm_xy(wks,zave&lat,zave1,res)
> 
> 
> 
> Subject: Re: [ncl-talk] problems with legends side-by-side.
> From: meier-fleischer at dkrz.de
> Date: Mon, 30 Mar 2015 17:25:33 +0200
> CC: ncl-talk at ucar.edu
> To: vanucia-schumacher at hotmail.com
> 
> Hi Vanucia,
> 
> without any further information it is not possible to help. As you mentioned the example xy_32.ncl does what you want.
> Send your script and the error message.
> 
> Bye,
> Karin
> 
> Am 30.03.2015 um 17:19 schrieb Vanúcia Schumacher <vanucia-schumacher at hotmail.com>:
> 
> Hi users,
> 
> I would like to put subtitles side -by-side , 3 on top
> and 4 below (attached )
> 
> Anyone know how can I do? already tried the example xy_32.ncl but failed.
> <ts.zonal.labels1.png>_______________________________________________
> 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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150330/1fc5a2d6/attachment.html 


More information about the ncl-talk mailing list