<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Michele,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I'm CC-ing ncl-talk, as we prefer for people to post back to the list rather than emailing developers individually.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Use gsn_add_text instead of gsn_text, in the same way you are using gsn_add_polyline. Make sure you use a different id:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><span style="color:rgb(255,0,0);font-size:12.8000001907349px">txid1 = gsn_add_text(wks,mapannotation,"A"</span><span style="color:rgb(255,0,0);font-size:12.8000001907349px">,lon(145,23),lat(145,23),tres)</span><br style="color:rgb(255,0,0);font-size:12.8000001907349px"><br style="color:rgb(255,0,0);font-size:12.8000001907349px"><span style="color:rgb(255,0,0);font-size:12.8000001907349px">txid2 = gsn_add_text(wks,mapannotation,"B"</span><span style="color:rgb(255,0,0);font-size:12.8000001907349px">,lon(145,79),lat(145,79),tres)</span><br></div><div class="gmail_extra"><br><div class="gmail_quote"><div class="gmail_default" style="font-size:small;display:inline">--Mary</div></div><div class="gmail_quote"><div class="gmail_default" style="font-size:small;display:inline"><br></div></div><div class="gmail_quote"><div class="gmail_default" style="font-size:small;display:inline"></div>On Thu, Jul 9, 2015 at 5:54 AM, Michele Petrini <span dir="ltr"><<a href="mailto:mpetrini139@yahoo.it" target="_blank">mpetrini139@yahoo.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
Dear Mary,<br>
it works fine. Now I'm trying to add also two letters inside the
legend plot (in order to label the polyline I drew), using the red
code below;<span class=""><br>
<br>
isoplot =
gsn_csm_xy2(wks,xiso,brockplot1(25:77),icetplot1(25:77),resL,resR)<br>
<br>
mapannotation =
gsn_csm_contour_map(wks,Hicetfmask(45:226,1:140),res1)<br>
<br>
</span><font color="#ff0000"> tres = True<br>
tres@txFontHeightF = 0.01<br>
tres@txFontColor = "red"<br>
<br>
gsn_text(wks,mapannotation,"A",lon(145,23),lat(145,23),tres)<br>
<br>
gsn_text(wks,mapannotation,"B",lon(145,79),lat(145,79),tres)</font><span class=""><br>
<br>
ypts = (/lat(145,25),lat(145,77)/)<br>
xpts = (/lon(145,25),lon(145,77)/)<br>
<br>
res2 = True<br></span>
res2@gsLineColor = "red"<br>
res2@gsLineThicknessF = 3.0<span class=""><br>
<br>
dum = new(1,graphic)<br>
dum = gsn_add_polyline(wks,mapannotation,xpts(0:1),ypts(0:1),res2)<br>
<br>
amres = True<br></span>
amres@amParallelPosF = -0.55<br>
amres@amOrthogonalPosF = 0.97<br>
amres@amJust = "BottomLeft"<br>
<br>
map_final = gsn_add_annotation(isoplot,mapannotation,amres)<br>
<br>
resF = True<br>
resF@txString = "Isostasy profile over LIS"<br>
resF@txFont = 21<br>
resF@txFontHeightF = 0.03<br>
<br>
gsn_panel(wks,isoplot,(/1,1/),resF)<br>
<br>
What I get is the two letters A, B inside the main XYY plot. I
really can't get why...<br>
<br>
Thank you,<br>
Michele<div><div class="h5"><br>
<br>
<br>
<div>On 08/07/2015 18:11, Mary Haley wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div style="font-size:small">Michele,</div>
<div style="font-size:small"><br>
</div>
<div style="font-size:small">I think the
error might be coming from trying to panel the "id" created
from calling gsn_add_annotation, rather than the actual plot.
Try this:</div>
<div style="font-size:small"><br>
</div>
<div style="font-size:small"><span style="font-size:12.8000001907349px">
gsn_panel(wks,isoplot,(/1,1/</span><span style="font-size:12.8000001907349px">),False)</span><br>
</div>
<div style="font-size:small"><span style="font-size:12.8000001907349px"><br>
</span></div>
<div style="font-size:small"><span style="font-size:12.8000001907349px">You might also look
into maximize_output</span></div>
<div style="font-size:small"><span style="font-size:12.8000001907349px"><br>
</span></div>
<div style="font-size:small"><span style="font-size:12.8000001907349px">--Mary</span></div>
<div style="font-size:small"><span style="font-size:12.8000001907349px"><br>
</span></div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Wed, Jul 8, 2015 at 5:58 AM, Michele
Petrini <span dir="ltr"><<a href="mailto:mpetrini139@yahoo.it" target="_blank">mpetrini139@yahoo.it</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> Dear helpdesk,<br>
I am trying to attach a small map as a legend of a XY plot
(with double different Y axes). The map I need to attach
must contain also a line, added with gsn_add_polyline. The
two single plots (the XYY plot and the map with the
polyline) are correct (I drew them separately first), but
as I use gsn_add_annotation I get the following error
message:<br>
<br>
<br>
<font color="#000066">fatal:Invalid plot ID=282 passed to
NhlGetBB<br>
warning:pmOverlaySequenceIds isn't a resource in this
object<br>
warning:NhlGetValues:Error retrieving
pmOverlaySequenceIds<br>
fatal:["Execute.c":8578]:Execute: Error occurred at or
near line 1927 in file
$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl<br>
<br>
fatal:["Execute.c":8578]:Execute: Error occurred at or
near line 6847 in file
$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl<br>
<br>
fatal:["Execute.c":8578]:Execute: Error occurred at or
near line 7546 in file
$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl<br>
<br>
fatal:["Execute.c":8578]:Execute: Error occurred at or
near line 647 in file Exercise1.ncl</font><br>
<br>
Do you have any idea the reason why I get such an error?
Here is the code.<br>
<br>
--------------------------------------------------------------------------------------------------------------------------------<br>
;***************************************set resources for
the isostasy plot (Left)<br>
<br>
resL = True<br>
<br>
resL@tiYAxisString = "Variation in bedrock
elevation (30-0 kyrs BP) (m)"<br>
resL@tiXAxisFontHeightF = 0.02<br>
resL@tiYAxisFontHeightF = 0.02<br>
<br>
resL@xyLineColors =
20 ;
Define line colors.<br>
resL@xyLineThicknessF =
3.0
; Define line thickness.<br>
resL@xyDashPattern =
0
; Make curves all solid <br>
<br>
resL@trYMaxF = -150.<br>
resL@trYMinF = -850.<br>
<br>
resL@tmXTOn = False<br>
<br>
resL@tmYLMinorOn = False<br>
resL@tmYLLabelFont = 21<br>
resL@tmYLLabelFontHeightF = 0.02<br>
<br>
resL@pmLegendDisplayMode = "Always"<br>
resL@lgPerimOn = False<br>
resL@xyExplicitLegendLabels = "Topography variation (m)"<br>
resL@pmLegendSide = "Bottom" <br>
resL@pmLegendOrthogonalPosF = 0.01<br>
resL@pmLegendWidthF = 0.4<br>
resL@pmLegendHeightF = 0.04<br>
<br>
resL@vpHeightF = 0.4<br>
resL@vpWidthF = 0.4<br>
<br>
<br>
resL@lgAutoManage = False <br>
resL@tmXBMode =
"Explicit"
; Define your own tick mark labels.<br>
;resL@tmXBLabelFont =
21
; Change font of labels.<br>
;resL@tmXBLabelFontHeightF = 0.02<br>
resL@tmXBMinorOn =
False
; No minor tick marks.<br>
resL@tmXBValues =
(/xiso(0),xiso(52)/)
; Location to put tick mark labels<br>
resL@tmXBLabels = (/"A","B"/)
<br>
<br>
resL@gsnDraw = False ;
do not draw picture<br>
resL@gsnFrame = False ;
do not advance frame<br>
<br>
<br>
;******************************************set resources
for ice thickness plot (right) <br>
<br>
resR = True<br>
<br>
resR@tiYAxisString = "Variation in ice
thickness (30-0 kyrs BP) (m)"<br>
resR@tiXAxisFontHeightF = 0.02<br>
resR@tiYAxisFontHeightF = 0.02<br>
<br>
resR@xyLineColors =
21
; Define line colors.<br>
resR@xyLineThicknessF =
3.0
; Define line thickness.<br>
resR@xyDashPattern =
1
; Make curves all solid<br>
<br>
resR@trYMaxF = 3100<br>
resR@trYMinF = 600<br>
<br>
resR@tmXBOn = False<br>
resR@tmXTOn = False<br>
<br>
resR@tmYRMinorOn = False<br>
resR@tmYRLabelFont = 21<br>
resR@tmYRLabelFontHeightF = 0.02<br>
<br>
resR@vpHeightF = 0.4<br>
resR@vpWidthF = 0.4<br>
<br>
<br>
resR@pmLegendDisplayMode = "Always"<br>
resR@lgPerimOn = False<br>
resR@xyExplicitLegendLabels = "Ice thickness variation
(m)"<br>
resR@pmLegendSide = "Bottom"<br>
resR@pmLegendOrthogonalPosF = 0.06<br>
resR@pmLegendWidthF = 0.4<br>
resR@pmLegendHeightF = 0.04<br>
resR@lgAutoManage = False<br>
resR@gsnDraw = False ;
do not draw picture<br>
resR@gsnFrame = False ;
do not advance frame<br>
<br>
<br>
;******************************************set resources
for legend plot<br>
res1 = True<br>
res1@gsnDraw = False<br>
res1@gsnFrame = False<br>
<br>
<br>
res1@mpLimitMode = "Corners" ;
choose range of map<br>
res1@mpLeftCornerLatF = lat(41,1)<br>
res1@mpLeftCornerLonF = lon(41,1)<br>
res1@mpRightCornerLatF = lat(226,139)<br>
res1@mpRightCornerLonF = lon(226,139)<br>
<br>
res1@mpProjection = "LambertEqualArea"<br>
res1@mpCenterLatF = 90<br>
res1@mpCenterLonF = 0<br>
res1@mpOutlineOn = True<br>
res1@tfDoNDCOverlay = True<br>
<br>
res1@cnFillOn = True<br>
res1@cnLevelSelectionMode = "ManualLevels"<br>
res1@cnMinLevelValF = 0<br>
res1@cnMaxLevelValF = 5000<br>
res1@cnLevelSpacingF = 50<br>
res1@gsnDraw = False ;
do not draw picture<br>
res1@gsnFrame = False ;
do not advance frame<br>
<br>
res1@cnLinesOn = False ;
contour lines<br>
res1@cnLineLabelsOn = False ;
no contour labels<br>
res1@gsnSpreadColors = True ;
use total colormap<br>
res1@gsnSpreadColorStart = 2<br>
res1@gsnSpreadColorEnd = 27<br>
res1@cnInfoLabelOn = False ;
no contour info (right bottom)<br>
res1@lbLabelBarOn = False<br>
<br>
res1@vpHeightF = 0.2<br>
res1@vpWidthF = 0.2<br>
<br>
;****************************************************end
resources<br>
<br>
isoplot =
gsn_csm_xy2(wks,xiso,brockplot1(25:77),icetplot1(25:77),resL,resR)
<br>
<br>
mapannotation =
gsn_csm_contour_map(wks,Hicetfmask(45:226,1:140),res1)<br>
<br>
ypts = (/lat(145,25),lat(145,77)/)<br>
xpts = (/lon(145,25),lon(145,77)/)<br>
<br>
res2 = True<br>
res2@gsLineColor = "black"<br>
res2@gsLineThicknessF = 3.0<br>
res2@gsLineLabelString = "A B"<br>
<br>
dum = new(1,graphic)<br>
dum =
gsn_add_polyline(wks,mapannotation,xpts(0:1),ypts(0:1),res2)<br>
<br>
amres = True<br>
amres@amParallelPosF = -1.15<br>
amres@amOrthogonalPosF = -0.4<br>
amres@amJust = "CenterLeft"<br>
<br>
map_final =
gsn_add_annotation(isoplot,mapannotation,amres)<br>
<br>
gsn_panel(wks,map_final,(/1,1/),False)<br>
<br>
delete(resL)<br>
delete(resR)<br>
delete(res1)<br>
delete(res2) <br>
delete(amres)<br>
----------------------------------------------------------------------------------------------------------------------------------<br>
<br>
Thank you for you help,<br>
<br>
Michele<br>
<pre cols="72">--
***
Michele Petrini
Ph.D. student in Earth Science and Fluid Mechanics
Università degli studi di Trieste,
Dipartimento di Matematica e Geoscienze
Palazzina C - via Weiss 1, 34128 Trieste, Italy
Email: <a href="mailto:mpetrini139@yahoo.it" target="_blank">mpetrini139@yahoo.it</a>
Skype: michele.petrins
Mobile: <a href="tel:%2B39%203398367372" value="+393398367372" target="_blank">+39 3398367372</a>
</pre>
</div>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a 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>
</div>
</blockquote>
<br>
<pre cols="72">--
***
Michele Petrini
Ph.D. student in Earth Science and Fluid Mechanics
Università degli studi di Trieste,
Dipartimento di Matematica e Geoscienze
Palazzina C - via Weiss 1, 34128 Trieste, Italy
Email: <a href="mailto:mpetrini139@yahoo.it" target="_blank">mpetrini139@yahoo.it</a>
Skype: michele.petrins
Mobile: <a href="tel:%2B39%203398367372" value="+393398367372" target="_blank">+39 3398367372</a>
</pre>
</div></div></div>
</blockquote></div><br></div></div>