<div dir="ltr">Thanks Adam.<div><br></div><div>Just to update btw (if anyone faces a similar problem) - I tried gsn_polygon, solves everything.</div><div><br></div><div>Thanks,</div><div>V.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 30, 2015 at 7:16 AM, Adam Phillips <span dir="ltr">&lt;<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi Vandhna,<br></div>One thing that I do see is that you are not setting resR@gsnDraw = False or resR@gsnFrame = False. Thus, ncl will attempt to draw/frame your plot3/plot4.<br><br></div>If that does not completely fix the issue you are having, I would strongly encourage you to comment out the numerous calls to gsn_polyline/gsn_polymarker calls prior to the plot1/plot2 etc creation. A good basic debugging tenet is to remove lines/make your script simpler, and hopefully by doing that you can identify where things are going wrong..<br><br></div>Good luck,<br>Adam<br><div><div><br><br><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Thu, Jan 29, 2015 at 3:03 AM, Vandhna Nair <span dir="ltr">&lt;<a href="mailto:n.vandhna@gmail.com" target="_blank">n.vandhna@gmail.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi all,<br><div class="gmail_quote"><div dir="ltr"><div><br></div><div>I am trying to plot 4 curves (station observations), with their model simulated ranges (min, max) as filled areas using gsnXYFillColors.</div><div><br></div><div>I get the 4 curves and everything else just fine using the script below (ignore highlighted part for now). </div><div><br></div><div><div>; ***********************************************</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;</div><div>load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl&quot;</div><div>; ***********************************************</div><div><br></div><div>p1 = asciiread(&quot;Station_Suva_pr.csv&quot;,(/12,1/),&quot;float&quot;) </div><div>p2 = asciiread(&quot;Station_Nadi_pr.csv&quot;,(/12,1/),&quot;float&quot;) </div><div>p3 = asciiread(&quot;Suva_mod_pr.csv&quot;,(/12,2/),&quot;float&quot;) </div><div>p4 = asciiread(&quot;Nadi_mod_pr.csv&quot;,(/12,2/),&quot;float&quot;) </div><div>t1 = asciiread(&quot;Station_Suva_tm.csv&quot;,(/12,1/),&quot;float&quot;) </div><div>t2 = asciiread(&quot;Station_Nadi_tm.csv&quot;,(/12,1/),&quot;float&quot;) </div><div>t3 = asciiread(&quot;Suva_mod_tm.csv&quot;,(/12,2/),&quot;float&quot;) </div><div>t4 = asciiread(&quot;Nadi_mod_tm.csv&quot;,(/12,2/),&quot;float&quot;) </div><div><br></div><div>lp1 = p3(:,0)</div><div>lp2 = p3(:,1)</div><div>lp3 = p4(:,0)</div><div>lp4 = p4(:,1)</div><div><br></div><div>lt1 = t3(:,0)</div><div>lt2 = t3(:,1)</div><div>lt3 = t4(:,0)</div><div>lt4 = t4(:,1)</div><div><br></div><div><br></div><div>; ***********************************************</div><div>; create new date array for use on the plot</div><div>; ***********************************************</div><div><br></div><div>  date  = ispan(0,11,1) + 1</div><div>  print(date)</div><div>  monthnames = (/&quot;Jan&quot;, &quot;Feb&quot;, &quot;Mar&quot;, &quot;Apr&quot; \</div><div>            ,&quot;May&quot;, &quot;Jun&quot;, &quot;Jul&quot;, &quot;Aug&quot;         \</div><div>            ,&quot;Sep&quot;, &quot;Oct&quot;, &quot;Nov&quot;      \</div><div>            ,&quot;Dec&quot; /)</div><div><span style="white-space:pre-wrap">                        </span></div><div><span style="white-space:pre-wrap">                        </span></div><div>;**********************************************************</div><div>; to plot multiple lines (shading), you must put them into</div><div>; a mulidimensional array</div><div>;**********************************************************</div><div><br></div><div>data = new((/2,12/),float)</div><div>data(0,:) = p3(:,0)</div><div>data(1,:) = p3(:,1)<span style="white-space:pre-wrap">        </span></div><div><br></div><div>data1 = new((/2,12/),float)</div><div>data1(0,:) = p4(:,0)</div><div>data1(1,:) = p4(:,1)<span style="white-space:pre-wrap">        </span></div><div><br></div><div>data2 = new((/2,12/),float)</div><div>data2(0,:) = t3(:,0)</div><div>data2(1,:) = t3(:,1)</div><div><br></div><div>data3 = new((/2,12/),float)</div><div>data3(0,:) = t4(:,0)</div><div>data3(1,:) = t4(:,1)</div><div><br></div><div>;***************************</div><div>; plot parameters</div><div>;***************************</div><div><br></div><div>wks = gsn_open_wks(&quot;eps&quot;,&quot;Suva_Nadi_cmp&quot;) ; Open an X11 workstation.</div><div><br></div><div>resL = True </div><div>resR = True </div><div><br></div><div>resL@gsnXYBarChart         = True            ; create bar chart </div><div>resL@gsnDraw            = False               ; don&#39;t draw</div><div>resL@gsnFrame = False                        ; don&#39;t advance frame yet  </div><div><br></div><div>;Change aspect ratio of plot</div><div> resL@vpHeightF= 0.38                   </div><div> resL@vpWidthF = 0.7       </div><div> </div><div>; Set min/max values for y axes</div><div><br></div><div> resL@trYMinF = 0</div><div> resL@trYMaxF = 600</div><div> resR@trYMinF = 16</div><div> resR@trYMaxF = 30</div><div><br></div><div> resL@vpXF     = 0.15           </div><div><br></div><div>; Define new markers</div><div><br></div><div>  mstring = &quot;y&quot;</div><div>  fontnum = 35</div><div>  xoffset = 0.0</div><div>  yoffset = 0.0</div><div>  ratio   = 1.0</div><div>  size    = 1.0</div><div>  angle   = 0.0</div><div>  </div><div>  Pr_index = NhlNewMarker(wks, mstring, fontnum, xoffset, yoffset, ratio, size, angle)</div><div>  </div><div>  mstring1 = &quot;u&quot;</div><div>  fontnum1 = 34</div><div>  xoffset1 = 0.0</div><div>  yoffset1 = 0.0</div><div>  ratio1   = 1.0</div><div>  size1    = 1.0</div><div>  angle1   = 0.0</div><div>  </div><div>  Tm_index = NhlNewMarker(wks, mstring1, fontnum1, xoffset1, yoffset1, ratio1, size1, angle1)</div><div><br></div><div>; resources for &quot;left&quot; variable</div><div>  resL@xyLineColor            = &quot;-1&quot;</div><div>  resL@xyLineThicknesses      = 3.                  </div><div>  resL@tiYAxisString = &quot;Precipitation (mm)&quot; </div><div>  resL@tiYAxisFontHeightF = 0.0198</div><div><br></div><div>; resources for &quot;right&quot; variable</div><div>  resR@xyLineColor            = &quot;limegreen&quot;                            </div><div>  resR@xyLineThicknesses      = 3.                   </div><div>  resR@tiYAxisString = &quot;Temperature (~S~o~N~C)&quot; </div><div>  resR@tiYAxisFontHeightF = 0.0198</div><div>  </div><div>  resL@tiMainString    = &quot;Suva and Nadi Climatologies~C~Precipitation and Temperature&quot;</div><div>  resL@tiMainOffsetYF  = 0.01</div><div>  resL@tiMainFontHeightF = 0.0240</div><div>  resL@tiMainFontThicknessF = 3.0</div><div>  </div><div>; Marker resources</div><div>  mres = True</div><div>  mres@gsMarkerIndex = Tm_index</div><div>  mres@gsMarkerSizeF = 18.0           </div><div>  mres@gsMarkerColor = (/&quot;limegreen&quot;/)  </div><div>  </div><div>  mres1 = True</div><div>  mres1@gsMarkerIndex = Tm_index</div><div>  mres1@gsMarkerSizeF = 18.0           </div><div>  mres1@gsMarkerColor = (/&quot;tomato2&quot;/)</div><div>  </div><div>  mres2 = True</div><div>  mres2@gsMarkerIndex = Pr_index</div><div>  mres2@gsMarkerSizeF = 10.0           </div><div>  mres2@gsMarkerColor = (/&quot;limegreen&quot;/)</div><div>  </div><div>  mres3 = True</div><div>  mres3@gsMarkerIndex = Pr_index</div><div>  mres3@gsMarkerSizeF = 10.0           </div><div>  mres3@gsMarkerColor = (/&quot;tomato2&quot;/)</div><div>  </div><div>; Polyline resources</div><div><br></div><div>  pres                  = True</div><div>  pres@gsLineThicknessF = 3.0</div><div>  pres@gsLineColor = &quot;limegreen&quot;</div><div><br></div><div>  pres1                  = True</div><div>  pres1@gsLineThicknessF = 3.0</div><div>  pres1@gsLineColor = &quot;tomato2&quot;</div><div> </div><div> ;Formatting axis labels</div><div>  </div><div>  resR@tmYRFormat = &quot;f&quot;                           ; remove decimal values from right Y-axis label</div><div> </div><div>  resR@tmXBMode        = &quot;Explicit&quot;<span style="white-space:pre-wrap">        </span></div><div>  resR@tmXBValues      = (/16,18,20,22,24,26,28,30/)</div><div>  </div><div>  resL@tmXBMode          = &quot;Explicit&quot;              ; explicit labels</div><div>  resL@tmXBValues        = date                    ; location of labels </div><div>  resL@tmXBLabels        = monthnames              ; labels themselves</div><div>  </div><div>  resL@gsnYRefLine           = 0.0               ; create a reference line</div><div>  </div><div>  </div><div>  plot = gsn_csm_xy2(wks,date,p1(:,0),t1(:,0),resL,resR)   </div><div>  </div><div>  gsn_polymarker(wks,plot@xy2,date,t1(:,0),mres)</div><div>  gsn_polyline(wks,plot@xy2,date,t2(:,0),pres1)</div><div>  gsn_polymarker(wks,plot@xy2,date,t2(:,0),mres1)</div><div>  gsn_polyline(wks,plot,date,p1(:,0),pres)</div><div>  gsn_polymarker(wks,plot,date,p1(:,0),mres2)</div><div>  gsn_polyline(wks,plot,date,p2(:,0),pres1)</div><div>  gsn_polymarker(wks,plot,date,p2(:,0),mres3)</div><div><br></div><div><span style="background-color:rgb(255,255,0)">; Create a plot with the area between min and max simulations filled in pink/blue</span></div><div><span style="background-color:rgb(255,255,0)"> </span></div><div><span style="background-color:rgb(255,255,0)"> print(data)</span></div><div><span style="background-color:rgb(255,255,0)"> print(data1)</span></div><div><span style="background-color:rgb(255,255,0)"> print(data2)</span></div><div><span style="background-color:rgb(255,255,0)"> print(data3)</span></div><div><span style="background-color:rgb(255,255,0)"> </span></div><div><span style="background-color:rgb(255,255,0)"> ; 1st shading</span></div><div><span style="background-color:rgb(255,255,0)">  delete(resL@xyLineColors) </span></div><div><span style="background-color:rgb(255,255,0)">  resL@gsnXYFillColors = &quot;lightpink&quot; </span></div><div><span style="background-color:rgb(255,255,0)">  resL@xyLineColor = &quot;-1&quot;</span></div><div><span style="background-color:rgb(255,255,0)">  plot1  = gsn_csm_xy(wks,date,data,resL)</span></div><div><span style="background-color:rgb(255,255,0)">  </span></div><div><span style="background-color:rgb(255,255,0)"> ; 2nd shading</span></div><div><span style="background-color:rgb(255,255,0)"> resL@gsnXYFillColors = &quot;lightskyblue&quot; </span></div><div><span style="background-color:rgb(255,255,0)"> resL@xyLineColor = &quot;-1&quot;</span></div><div><span style="background-color:rgb(255,255,0)"> plot2  = gsn_csm_xy(wks,date,data1,resL)</span></div><div><span style="background-color:rgb(255,255,0)">  </span></div><div><span style="background-color:rgb(255,255,0)"> ; 3rd shading </span></div><div><span style="background-color:rgb(255,255,0)"> delete(resR@xyLineColors) </span></div><div><span style="background-color:rgb(255,255,0)"> resR@gsnXYFillColors = &quot;lightpink&quot; </span></div><div><span style="background-color:rgb(255,255,0)"> resR@xyLineColor = &quot;-1&quot;</span></div><div><span style="background-color:rgb(255,255,0)"> plot3  = gsn_csm_xy(wks,date,data2,resR)</span></div><div><span style="background-color:rgb(255,255,0)"> </span></div><div><span style="background-color:rgb(255,255,0)"> ; 4th shading</span></div><div><span style="background-color:rgb(255,255,0)"> resR@gsnXYFillColors = &quot;lightskyblue&quot; </span></div><div><span style="background-color:rgb(255,255,0)"> resR@xyLineColor = &quot;-1&quot;</span></div><div><span style="background-color:rgb(255,255,0)"> plot4  = gsn_csm_xy(wks,date,data3,resR)</span></div><div><span style="background-color:rgb(255,255,0)">  </span></div><div><span style="background-color:rgb(255,255,0)"> overlay(plot,plot1) </span></div><div><span style="background-color:rgb(255,255,0)"> overlay(plot,plot2)</span></div><div><span style="background-color:rgb(255,255,0)"> overlay(plot,plot3)</span></div><div><span style="background-color:rgb(255,255,0)"> overlay(plot,plot4)</span></div><div><span style="background-color:rgb(255,255,0)"><br></span></div><div> ;*********************** </div><div> ; Manually add legend</div><div> ;***********************</div><div> </div><div> ; Polylines and polymarkers</div><div><br></div><div>  gsres             = True</div><div>  gsres@gsLineColor = &quot;limegreen&quot;</div><div>  gsres@gsLineThicknessF = 3.0</div><div>  gsres@gsMarkerIndex = Pr_index</div><div>  gsres@gsMarkerColor = &quot;limegreen&quot;  </div><div>  gsres@gsMarkerSizeF = 10</div><div>  </div><div>  gsn_polyline_ndc(wks,(/0.2,0.3/),(/0.31,0.31/),gsres) </div><div>  gsn_polymarker_ndc(wks,0.25,0.31,gsres) </div><div>  </div><div>  gsres1             = True</div><div>  gsres1@gsLineColor = &quot;limegreen&quot;</div><div>  gsres1@gsLineThicknessF = 3.0</div><div>  gsres1@gsMarkerIndex = Tm_index</div><div>  gsres1@gsMarkerColor = &quot;limegreen&quot;  </div><div>  gsres1@gsMarkerSizeF = 18</div><div>  </div><div>  gsn_polyline_ndc(wks,(/0.2,0.3/),(/0.28,0.28/),gsres1) </div><div>  gsn_polymarker_ndc(wks,0.25,0.28,gsres1)</div><div>  </div><div>  gsres2             = True</div><div>  gsres2@gsLineColor = &quot;tomato2&quot;</div><div>  gsres2@gsLineThicknessF = 3.0</div><div>  gsres2@gsMarkerIndex = Pr_index</div><div>  gsres2@gsMarkerColor = &quot;tomato2&quot;  </div><div>  gsres2@gsMarkerSizeF = 10</div><div>  </div><div>  gsn_polyline_ndc(wks,(/0.55,0.65/),(/0.31,0.31/),gsres2) </div><div>  gsn_polymarker_ndc(wks,0.60,0.31,gsres2) </div><div>  </div><div>  gsres3             = True</div><div>  gsres3@gsLineColor = &quot;tomato2&quot;</div><div>  gsres3@gsLineThicknessF = 3.0</div><div>  gsres3@gsMarkerIndex = Tm_index</div><div>  gsres3@gsMarkerColor = &quot;tomato2&quot;  </div><div>  gsres3@gsMarkerSizeF = 18</div><div>  </div><div>  gsn_polyline_ndc(wks,(/0.55,0.65/),(/0.28,0.28/),gsres3) </div><div>  gsn_polymarker_ndc(wks,0.60,0.28,gsres3)</div><div>  </div><div> ; Text</div><div> </div><div>  txres = True</div><div>  txres@txFontHeightF = 0.017</div><div>  </div><div>  gsn_text_ndc(wks,&quot;Suva precipitation&quot;,0.41,0.31,txres)</div><div>  gsn_text_ndc(wks,&quot;Suva temperature&quot;,0.41,0.28,txres)</div><div>  gsn_text_ndc(wks,&quot;Nadi precipitation&quot;,0.76,0.31,txres)</div><div>  gsn_text_ndc(wks,&quot;Nadi temperature&quot;,0.76,0.28,txres)</div><div>  </div><div>  draw(plot)                                     ; now draw</div><div>  frame(wks)                                   ; now advance frame</div><div> </div><div>;end</div></div><div><br></div><div><br></div><div>However, when I add the highlighted part to my script, I get &quot;<span><font color="#000000" face="arial, helvetica, sans-serif">fill_bw_xy: Error: If filling between two curves, one set must be 2D, and the other 1D&quot;. Also, the plot generated looks very strange - completely destroys my existing plot. Perhaps I am making some trivial mistake as I am using overlay and gsnXYFillColors with 2Y axes for the first time. </font></span></div><div><span><font color="#000000" face="arial, helvetica, sans-serif"><br></font></span></div><div><font color="#000000" face="arial, helvetica, sans-serif">Any help would be highly appreciated. </font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">Attached are:</font></div><div><font color="#000000" face="arial, helvetica, sans-serif">1. Working plot, without </font><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">gsnXYFillColors - Suva_Nadi_cmp.eps</span></div><div><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">2. Plot after adding the highlighted bit - </span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">Suva_Nadi_cmp2.eps</span></div><div><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">3. One of the 4 data files used in </span><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif">gsnXYFillColors, just incase it&#39;s needed - </span>Suva_mod_pr.csv</div><div><br></div><div>Thanks,</div><div>Vandhna.</div></div>
</div><br></div>
<br></div></div>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><br>-- <br><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 Division, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a>   </font></span><span><font color="#888888"><a href="tel:303-497-1726" value="+13034971726" target="_blank">303-497-1726</a> </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div>
</font></span></div>
</blockquote></div><br></div>