Re: overlays are staggered in X direction

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Thu Apr 12 2012 - 11:30:49 MDT

Hi James,
If you're OK with one label bar being positioned vertically and one
positioned horizontally as Mary suggests I think that's the easiest way
to go.

Otherwise, I see 2 options:
1) You can try various settings of pmLabelBarOrthogonalPosF and
pmLabelBarParallelPosF to see if you can move things around enough. I'm
not sure that overlay will give you complete control over this though,
although I've never tried what you're doing.
2) Draw 1 labelbar normally, then draw the second labelbar manually
using either gsn_create_labelbar or gsn_labelbar_ndc. This may get a bit
tedious to match your previous labelbar. See examples 9, 11, 13 here:
http://www.ncl.ucar.edu/Applications/labelbar.shtml

If the above doesn't help let us know.. Adam

On 04/12/2012 11:13 AM, James Correia, Jr wrote:
> Hi-
> Thanks for the reply Adam.
>
> So that gets the plot to overlay, but the title's become offset (not a
> big deal since I can just leave one of them off), but the left color
> bar (which now appears) sits below the right color bar. Thus it fell
> off the page when I was maximized.
>
> Is there anyway to control the placement of the left color bar without
> overlay interfering?
> jimmyc
>
> On Thu, Apr 12, 2012 at 11:57 AM, Adam Phillips <asphilli@ucar.edu
> <mailto:asphilli@ucar.edu>> wrote:
>
> Hi James,
> The order you tried to do things is correct. I would try a bit
> more to get method #1 working.. You are setting gsnMaximize=True
> and I wonder if overlay is not working correctly with gsnMaximize
> when there are 2 labelbars. I'd try turning gsnMaximize = False,
> and see if you can get the 2nd label bar on there by simply doing
> that. I'd also set vpXF = 0.1 (or 0.05) and vpYF = 0.9 (or 0.95).
> Assuming this method works, you can maximize things on the frame
> by calling maximize_output after you call overlay:
> http://www.ncl.ucar.edu/Document/Graphics/Interfaces/maximize_output.shtml
>
> If that doesn't work let ncl-talk know.. Adam
>
>
>
> On 04/12/2012 09:24 AM, James Correia, Jr wrote:
>> Hi-
>> I am trying to overlay 2 color filled plot objects and use 2
>> color bars (located below the plot).
>>
>> 1. When I use the overlay function (overlay(plo1,plot2)), I am
>> missing a color bar (most likely it is appearing below viewable
>> page).
>>
>> 2. When I use the overlay option (gsn_csm_contour_map_overlay) I
>> only get 1 color bar (probably the same error as above).
>>
>> 3. When I use two calls to gsn_csm_contour_map and manually
>> overlay them (using two draw commands) the result is that one
>> image is shifted to the right of the other image.
>> For this problem I tried to set resources vpXF and vpYF for both
>> sets of resources and there was no change.
>>
>> Does anyone know which resources I may be missing or setting
>> incorrectly?
>>
>> rmap = True
>> rmap@mpProjection = "LambertConformal"
>> rmap@mpLimitMode = "Corners"
>> rmap@mpLeftCornerLatF = lat2d(y1,x1) ;lat2d(0,0)
>> rmap@mpLeftCornerLonF = lon2d(y1,x1) ;lon2d(0,0)
>> rmap@mpRightCornerLatF = lat2d(y2,x2) ;lat2d(692,862)
>> rmap@mpRightCornerLonF = lon2d(y2,x2) ;lon2d(692,862)
>> rmap@mpLambertParallel1F = 30.
>> rmap@mpLambertParallel2F = 30.
>> rmap@mpLambertMeridianF = -97.
>> rmap@mpOutlineDrawOrder = "PostDraw" ; draw continental
>> outline last
>> rmap@mpFillDrawOrder = "PreDraw"
>> rmap@mpOutlineBoundarySets = "GeophysicalAndUSStates" ; state
>> boundaries
>> rmap@mpFillOn = False ; turn off map fill
>>
>> rmap@gsnMaximize = True
>> rmap@gsnPaperOrientation = "Portrait"
>> rmap@mpUSStateLineColor = "gray"
>> rmap@mpUSStateLineColor = "Black"
>> rmap@mpUSStateLineThicknessF = 1.
>> rmap@mpNationalLineColor = "Black"
>> rmap@mpNationalLineThicknessF = 1.
>> rmap@mpOutlineBoundarySets = "AllBoundaries"
>> ; rmap@mpDataBaseVersion = "Ncarg4_1" ; set to HighRes gets
>> coastline
>> ; rmap@mpDataSetName = "Earth..2" ; we want county lines
>>
>> rmap2 = True
>> rmap2@cnFillOn = True ; turn on color
>> rmap2@cnLinesOn = False ; turn on color
>> rmap2@cnLineLabelsOn = False
>> rmap2@cnLevelSelectionMode = "ExplicitLevels" ; set explicit
>> contour levels
>> rmap2@cnInfoLabelOn = False
>> rmap2@cnLineThicknessF = 2.
>>
>> rmap@cnFillOn = True ; turn on color
>> rmap@cnLinesOn = False ; turn on color
>> rmap@gsnSpreadColors = False ; use full range of
>> colormap
>> rmap@cnLevelSelectionMode = "ExplicitLevels" ; set explicit
>> contour levels
>> rmap@cnInfoLabelOn = False
>> rmap@cnLineLabelsOn = False
>>
>> rmap@gsnDraw = False
>> rmap@gsnFrame = False
>> rmap2@gsnDraw = False
>> rmap2@gsnFrame = False
>>
>> rmap@lbLabelBarOn = True ; turn off individual cb's
>> rmap@lbAutoManage = False
>> rmap@lbJustification = "TopRight"
>> rmap@lbOrientation = "Horizontal"
>> rmap@lbTitleDirection = "Across"
>> rmap@lbTitleOffsetF = 0.00
>> rmap@lbTitleExtentF = 0.17
>> rmap@lbLabelFontHeightF = 0.010 ; label bar font size
>> rmap@lbLabelFont = 25 ; label ba
>> rmap@lbPerimOn = False ; no box around
>> label bar
>> rmap@lbLabelAutoStride = True ; Avoid overlapping
>> label
>> rmap@lbLabelOffsetF = 0.05
>> rmap@lbLabelPosition = "Top"
>> rmap@lbTitleFontHeightF = 0.012 ; label bar title
>> font size
>> rmap@lbTitleFont = 25 ; label bar title font
>> rmap@lbTitlePosition = "Left"
>> rmap@pmLabelBarSide = "Bottom"
>> rmap@pmLabelBarWidthF = 0.28
>> rmap@pmLabelBarHeightF = 0.05
>> rmap@pmLabelBarParallelPosF = 0.75
>> rmap@pmLabelBarOrthogonalPosF = -0.005
>> rmap@lbTitleString = "g kg-1"
>>
>> rmap2@lbLabelBarOn = True ; turn off individual
>> cb's
>> rmap2@lbAutoManage = False
>> rmap2@lbJustification = "TopRight"
>> rmap2@lbOrientation = "Horizontal"
>> rmap2@lbTitleDirection = "Across"
>> rmap2@lbTitleOffsetF = 0.00
>> rmap2@lbTitleExtentF = 0.17
>> rmap2@lbLabelFontHeightF = 0.010 ; label bar font size
>> rmap2@lbLabelFont = 25 ; label ba
>> rmap2@lbPerimOn = False ; no box around
>> label bar
>> rmap2@lbLabelAutoStride = True ; Avoid
>> overlapping label
>> rmap2@lbLabelOffsetF = 0.05
>> rmap2@lbLabelPosition = "Top"
>> rmap2@lbTitleFontHeightF = 0.012 ; label bar title
>> font size
>> rmap2@lbTitleFont = 25 ; label bar title
>> font
>> rmap2@lbTitlePosition = "Left"
>> rmap2@pmLabelBarSide = "Bottom"
>> rmap2@pmLabelBarWidthF = 0.15
>> rmap2@pmLabelBarHeightF = 0.05
>> rmap2@pmLabelBarParallelPosF = 0.25 ; position of bar
>> rmap2@pmLabelBarOrthogonalPosF = -0.005
>> rmap2@lbTitleString = "m s-1"
>>
>> rmap@tiMainFontHeightF = 0.013
>> rmap@tiMainJust = "TopLeft"
>> rmap@tiMainPosition = "Left"
>> rmap@tiMainFontQuality = "High"
>> rmap@vpXF = .2
>> rmap@vpYF = .8
>>
>> rmap2@tiMainFontHeightF = 0.013
>> rmap2@tiMainJust = "TopLeft"
>> rmap2@tiMainPosition = "Left"
>> rmap2@tiMainFontQuality = "High"
>> rmap2@vpXF = .2
>> rmap2@vpYF = .8
>>
>>
>> do j=6,10 ;2,14
>> j1 = j+13
>> if(j1 .gt. 23)then
>> j1 = j1 - 24
>> end if
>> do a=0,0 ;ab-1
>> rmap@gsnLeftString = j1 + " UTC "+models(a)
>> rmap2@gsnLeftString = j1 + " UTC "+models(a)
>>
>> rmap2@cnLevels = (/.25/)
>> rmap@cnLevels = (/8,10,12,14,16,18/)
>> rmap2@cnFillColors = (/-1,3/)
>> rmap@cnFillColors = (/-1,5,6,7,8,9,10,11/)
>> plot =
>> gsn_csm_contour_map_overlay(wks,uh(a,j,:,:),w(a,j,:,:),rmap,rmap2)
>>
>> ;plot = gsn_csm_contour_map(wks,uh(a,j,:,:),rmap)
>> ;plota = gsn_csm_contour_map(wks,w(a,j,:,:),rmap2)
>>
>> print(rmap)
>> print(rmap2)
>>
>> resL = True
>> resL@gsMarkerIndex = 4
>> resL@gsMarkerThicknessF = .7
>> dr = new((/1000/),string)
>> dr = "black"
>> resL@gsMarkerColor = dr
>> dum = new((/2000/),graphic)
>> wq = -1
>> do l=0,0 ;ab-1
>> ci = where(u(l,j,:,:) .le. 76,1,0) ;151
>> temp = ind(ndtooned(where(ci.eq.1,1,0)))
>> if(.not.ismissing(temp(0)))then
>> do r=0,dimsizes(temp)-1
>> wq=wq+1
>> dum(wq) = gsn_add_polymarker(wks,plot,lon(temp(r)),lat(temp(r)),resL)
>> end do
>> end if
>> delete(temp)
>> end do
>>
>> ;overlay(plot,plota)
>> draw(plot)
>> ;draw(plota)
>> frame(wks)
>> end do
>> end do
>>
>>
>> --
>>
>> James Correia Jr.
>> OU CIMMS Research Scientist
>> SPC HWT Liaison
>>
>> "The highest function of the teacher consists not so much in
>> imparting knowledge as in stimulating the pupil in its love and
>> pursuit. To know how to suggest is the art of teaching."
>>
>> ------------------------------------------------------------------------------------------
>> The views expressed in this email do not necessarily reflect
>> those of NOAA, the National Weather Service, or the University of
>> Oklahoma.
>> ------------------------------------------------------------------------------------------
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> --
> ______________________________________________________________
> Adam Phillipsasphilli@ucar.edu <mailto:asphilli@ucar.edu>
> NCAR/Climate and Global Dynamics Division(303) 497-1726 <tel:%28303%29%20497-1726>
> P.O. Box 3000
> Boulder, CO 80307-3000http://www.cgd.ucar.edu/cas/asphilli
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
>
> --
>
> James Correia Jr.
> OU CIMMS Research Scientist
> SPC HWT Liaison
>
> "The highest function of the teacher consists not so much in imparting
> knowledge as in stimulating the pupil in its love and pursuit. To know
> how to suggest is the art of teaching."
>
> ------------------------------------------------------------------------------------------
> The views expressed in this email do not necessarily reflect those of
> NOAA, the National Weather Service, or the University of Oklahoma.
> ------------------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Apr 12 11:31:00 2012

This archive was generated by hypermail 2.1.8 : Fri Apr 13 2012 - 13:37:52 MDT