<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi Adam and thanks very much ! I made the changes you suggested and
it works.<br>
However, I still have a question : <br>
I get the plot as the one attached and so the vertical color bar
doesn't have all the colors I try to specify. Is there anything else
I should do to get all colors ? <br>
My code is ( as you wrote it) the addition at the end of mine of: <br>
<br>
gsn_panel(wks,plot,(/6,2/),resP)<br>
lbres = True<br>
lbres@lbPerimOn = False ; no label bar
box<br>
lbres@lbOrientation = "Vertical" ; orientation<br>
lbres@vpWidthF = 0.03 ; size<br>
lbres@vpHeightF = 0.3<br>
lbres@lbLabelFontHeightF = resP@lbLabelFontHeight<br>
lbres@lbLabelAlignment = "InteriorEdges" ; where to label<br>
lbres@lbMonoFillPattern = True ; fill sold<br>
lbres@lbFillColors = cmap_r<br>
gsn_labelbar_ndc(wks,26,fspan(-.005,.005,26),0.85,0.65,lbres)<br>
frame(wks)<br>
<br>
Ioana <br>
<br>
<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 06/11/15 16:56, Adam Phillips wrote:<br>
</div>
<blockquote
cite="mid:CACvWuqDvYbvC2_xgEjaX6EMaiJ+6OOo815FZOGP1HzXckhiRRg@mail.gmail.com"
type="cite">
<div dir="ltr">Hi Ioana,
<div>One thing that I see is that I think you meant to say
res@lbLabelBar<b>On</b>, and not res@lbLabelBar. (Same for
tres@lbLabelBar.) I also see that you are setting <span
style="font-size:12.8px">dres@cnLevelSelectionMode =
"ManualLevels" but you are not setting the
cnMinLevelValF/cnMaxLevelValF/cnLevelSpacingF resources as
you are for the tres resource list. I believe this will
result in NCL choosing the contour levels for your plots
created with the dres resource list, and thus they are
likely not the same for every plot. </span><br>
<br>
<div>I think the solution is to not draw the individual
labelbars (by setting res@lbLabelBarOn = False), draw the
first labelbar by leabing resP@gsnPanelLabelBar = True, and
then drawing the 2nd labelbar manually by calling
gsn_labelbar_ndc. (Alternatively you can call
gsn_create_labelbar, but in this case I think it would be
easier to use gsn_labelbar_ndc.)</div>
</div>
<div><br>
</div>
<div>For various label bar examples, see:</div>
<div><a moz-do-not-send="true"
href="http://www.ncl.ucar.edu/Applications/labelbar.shtml">http://www.ncl.ucar.edu/Applications/labelbar.shtml</a><br>
</div>
<div><br>
</div>
<div>
<div>In the coding below I will assume that your dres resource
list will have the contours defined like this:</div>
<div>
<div>dres@cnMinLevelValF = -0.03 ; set
min contour level</div>
<div>dres@cnMaxLevelValF = 0.03 ; set
max contour level</div>
<div>dres@cnLevelSpacingF = 0.005</div>
</div>
</div>
<div><br>
</div>
<div>I think all you need to do is to add the call to
gsn_labelbar_ndc at the end of your script:</div>
<div>resP@gsnFrame = False ; do not advance the frame with the
gsn_panel call<br>
</div>
<div><span style="font-size:12.8px">gsn_panel(wks,plot,(/6,2/),</span><span
style="font-size:12.8px">resP)</span></div>
<div>
<div><span style="font-size:12.8px">lbres
= True</span></div>
<div><span style="font-size:12.8px">lbres@lbPerimOn
= False ; no label bar box</span></div>
<div><span style="font-size:12.8px">lbres@lbOrientation
= "Vertical" ; orientation</span></div>
<div><span style="font-size:12.8px">lbres@vpWidthF
= 0.06 ; size</span></div>
<div><span style="font-size:12.8px">lbres@vpHeightF
= 0.6</span></div>
<div><span style="font-size:12.8px">lbres@lbLabelFontHeightF
= </span><span style="font-size:12.8px"> </span><span
style="font-size:12.8px">resP@lbLabelFontHeight</span></div>
<div><span style="font-size:12.8px">lbres@lbLabelAlignment
= "InteriorEdges" ; where to label</span></div>
<div><span style="font-size:12.8px">lbres@lbMonoFillPattern
= True ; fill sold</span></div>
<div><span style="font-size:12.8px">lbres@lbFillColors
= cmap_r </span></div>
<div><span style="font-size:12.8px">gsn_labelbar_ndc
(wks,14,fspan(-.03,.03,13),0.85,0.5,lbres)</span></div>
</div>
<div>frame(wks)</div>
<div><span style="font-size:12.8px">kk=kk+2</span><br
style="font-size:12.8px">
<span style="font-size:12.8px"> ll=ll+2</span><br
style="font-size:12.8px">
<span style="font-size:12.8px"> end do</span><br
style="font-size:12.8px">
<span style="font-size:12.8px"> end </span><br
style="font-size:12.8px">
</div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">The only possible issue I
see with the above is that I set:</span></div>
<div><span style="font-size:12.8px">lbres@lbFillColors =
cmap_r </span><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">I am not sure if you are
setting the exact number of colors that NCL is using for the
plots, or if NCL is spanning cmap_r. If it is the latter
case, I would set dres@cnFillColors manually:</span></div>
<div><span style="font-size:12.8px">dres@cnFillColors =
cmap_r(0::3,:) ; 0::3 is a guess to span the colormap</span></div>
<div><span style="font-size:12.8px">and then you can set </span></div>
<div><span style="font-size:12.8px">lbres@lbFillColors
= </span><span style="font-size:12.8px">dres@cnFillColors</span><span
style="font-size:12.8px"><br>
</span></div>
<div><br>
</div>
<div><span style="font-size:12.8px">Hope that at least gets you
on the right track. If you have any further questions please
respond to the ncl-talk email list.</span></div>
<div><span style="font-size:12.8px">Adam</span></div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Nov 6, 2015 at 6:53 AM, Ioana
Colfescu <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:ioana.colfescu@ed.ac.uk" target="_blank">ioana.colfescu@ed.ac.uk</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"> Hi, <br>
I'm trying to do a panel plot in which I want to use 2
different color bars in each plot in the panel. <br>
I do get the plots but I have a problem with the color
bars: I'd like to deactivate the individual color bars (
for each plot) and have the color bars as panel plot color
bars - i.e one horizontal ( like in the plot ) and one
vertical ( the second one which doesn't show up) but what
I get is the result attached. <br>
<br>
Could someone please tell me what should I change in my
script to make:<br>
- the individual color bars disappear for each plot <br>
- the second panel plot color bar appear to the left (
the vertical bar) <br>
I tried to set both the individual or panel resources for
plotting the bar to False/True but doesn't work. <br>
I attached the plot and the code. Thanks. <br>
Ioana <br>
<br>
Relevant code part: <br>
<br>
<br>
plot = new(12,graphic)<br>
res = True<br>
res@gsnDraw = False ; turn off draw<br>
res@gsnFrame = False ; turn off frame<br>
............................<br>
<b> res@lbLabelBar = False</b><br>
tres = res<br>
dres = res<br>
tres@cnFillPalette = "BlWhRe"<br>
<b> tres@lbLabelBar = False</b><br>
tres@lbOrientation = "horizontal"<br>
tres@mpFillOn = False ; turn
off map fill<br>
tres@cnLevelSelectionMode = "ManualLevels"<br>
tres@cnMinLevelValF = -0.03 ; set
min contour level<br>
tres@cnMaxLevelValF = 0.03 ; set
max contour level<br>
tres@cnLevelSpacingF = 0.005<br>
<b> cmap_r = read_colormap_file("NCV_manga")</b><b><br>
</b><b> dres@cnFillPalette = cmap_r</b><br>
<b>d</b><b>res@lbLabelBar = False</b><br>
dres@cnLevelSelectionMode = "ManualLevels"<br>
dres@mpShapeMode = "FreeAspect"<br>
kk=0<br>
ll=1<br>
do ii=0,5<br>
plot(kk) = gsn_csm_contour_map(wks,cont1(ii,:,:),tres)<br>
newvar=new((/dimsizes(cont1)/),typeof(cont1))<br>
newvar(ii,:,:)=agcms1@_FillValue<br>
newvar(ii,{-25:25},:)=cont1(ii,{-25:25},:)<br>
ter_plot = gsn_csm_contour(wks,newvar(ii,:,:)*100,dres)<br>
overlay(plot(kk),ter_plot)<br>
plot(ll) = gsn_csm_contour_map(wks,aagcm1(ii,:,:),tres)<br>
newvar2=new((/dimsizes(aagcm1)/),typeof(aagcm1))<br>
newvar2(ii,:,:)=aagcm1@_FillValue<br>
newvar2(ii,{-25:25},:)=aagcm1(ii,{-25:25},:)<br>
ter_plot2 =
gsn_csm_contour(wks,newvar2(ii,:,:)*100,dres)<br>
overlay(plot(ll),ter_plot2)<br>
resP=True<br>
resP@gsnMaximize = True ; large format<br>
<b> resP@gsnPanelLabelBar = True </b> ; add
common colorbar<br>
resP@lbLabelAutoStride = True ; auto stride on
labels<br>
resP@lbLabelFontHeight = 0.015<br>
resP@lbOrientation = "horizontal"<br>
; draw(plot)<br>
; frame(wks)<br>
gsn_panel(wks,plot,(/6,2/),resP)<br>
kk=kk+2<br>
ll=ll+2<br>
end do<br>
end <br>
<br>
</div>
<br>
The University of Edinburgh is a charitable body, registered
in<br>
Scotland, with registration number SC005336.<br>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
<a moz-do-not-send="true" href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a moz-do-not-send="true"
href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk"
rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div>
<div><span><font color="#888888">Adam
Phillips <br>
</font></span></div>
<span><font color="#888888">Associate
Scientist, </font></span><span><font
color="#888888">Climate and Global
Dynamics Laboratory, NCAR<br>
</font></span></div>
</div>
<div><span><font color="#888888"><a
moz-do-not-send="true"
href="http://www.cgd.ucar.edu/staff/asphilli/"
target="_blank"><a class="moz-txt-link-abbreviated" href="http://www.cgd.ucar.edu/staff/asphilli/">www.cgd.ucar.edu/staff/asphilli/</a></a>
</font></span><span><font color="#888888">303-497-1726
</font></span></div>
<span></span>
<div>
<div><span><font color="#888888"><br>
</font></span>
<div><span></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
</body>
</html>