<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Follow up:</div><div class="gmail_default" style="font-family:verdana,sans-serif">I found the better solution while delving around in some of the newer functions. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/rgba_to_color_index.shtml">rgba_to_color_index</a><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">my very simple example:</div><div class="gmail_default" style="font-family:verdana,sans-serif"><div class="gmail_default">y := (/<span class="Apple-tab-span" style="white-space:pre">        </span>17.,<span class="Apple-tab-span" style="white-space:pre">        </span>16.,<span class="Apple-tab-span" style="white-space:pre">        </span>20.,<span class="Apple-tab-span" style="white-space:pre">        </span>21.,<span class="Apple-tab-span" style="white-space:pre">        </span>4./)</div><div class="gmail_default">x := (/0,1,2,3,4/)</div><div class="gmail_default">colors := rgba_to_color_index( (/ (/0.972549,0,0/),(/0.533333,0.25098,0.12549/),(/0,0,0.972549/),(/0.972549,0.470588,0/),(/0.972549,0,0.972549/) /) )</div><div class="gmail_default">bars := True</div><div class="gmail_default">bars@gsnXYBarChart = True</div><div class="gmail_default">bars@trYMinF = 0.</div><div class="gmail_default">bars@gsnXYBarChartColors = colors</div><div class="gmail_default">plot = gsn_csm_xy(wks,x, y, bars)</div></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 17, 2015 at 5:32 PM, Alan Brammer <span dir="ltr"><<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a>></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 class="gmail_default" style="font-family:verdana,sans-serif">Hi Rick, </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">No problem. I see the difficulty there. </div><div class="gmail_default" style="font-family:verdana,sans-serif">This was the work around I came up with. Which is more than fine, just haven't had to define a colormap in a while. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default"><span class=""><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,0);font-size:13px">y := (/<span style="white-space:pre-wrap">        </span>17.,<span style="white-space:pre-wrap">        </span>16.,<span style="white-space:pre-wrap">        </span>20.,<span style="white-space:pre-wrap">        </span>21.,<span style="white-space:pre-wrap">        </span>4./)</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,0);font-size:13px">x := (/0,1,2,3,4/)</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,0);font-size:13px">colors := (/ (/0.972549,0,0/),(/0.533333,0.25098,0.12549/),(/0,0,0.972549/),(/0.972549,0.470588,0/),(/0.972549,0,0.972549/) /)</div></span><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,0);font-size:13px"><div class="gmail_default"><br></div><div class="gmail_default"><b>gsn_define_colormap(wks, array_append_record( (/ (/1.,1.,1./),(/0.,0.,0./)/),colors,0) ) ;; need a back/foreground color to start</b></div><div><br></div></div><span class=""><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,0);font-size:13px">bars := True</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,0);font-size:13px">bars@gsnXYBarChart = True</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,0);font-size:13px">bars@trYMinF = 0.</div></span><div class="gmail_default"><b><font color="#000000" face="verdana, sans-serif">bars@gsnXYBarChartColors := ispan(2,dimsizes(y)+1,1) ;; This would cause a problem if you don't have enough colors</font></b></div><span class=""><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,0);font-size:13px">plot = gsn_csm_xy(wks,x, y, bars)</div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,0);font-size:13px"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,0);font-size:13px"><br></div></span><span class="HOEnZb"><font color="#888888"><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,0);font-size:13px">Alan. </div><div class="gmail_default" style="font-family:verdana,sans-serif;color:rgb(0,0,0);font-size:13px"><br></div></font></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 17, 2015 at 5:21 PM, Rick Brownrigg <span dir="ltr"><<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>></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 Alan,<br><br></div>Yes, I see what you mean here. There is ambiguity on how to interpret the dimensionality of the colors array -- should it be construed as RGBa color-specs, or is it an array-of-arrays of colors for multiple y-curves? I'll file a ticket on this one.<br><br></div>I unfortunately don't have a good work-around for you... :-/<br><br></div>Rick<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Mon, Aug 17, 2015 at 12:21 PM, Alan Brammer <span dir="ltr"><<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a>></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><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">If it's not already in the pipeline, can rgba functionality be added to gsnXYBarChartColors at some point. In the intermediate time, it could be helpful to add to the documentation that it's colormap or named colors only at this point. I just went back and forth trying to make this work and failing with no obvious reason. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">I may be doing something wrong here, but I couldn't make it work. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Alan. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">test script:</div><div class="gmail_default" style="font-family:verdana,sans-serif"><div class="gmail_default">y := (/<span style="white-space:pre-wrap">        </span>17.,<span style="white-space:pre-wrap">        </span>16.,<span style="white-space:pre-wrap">        </span>20.,<span style="white-space:pre-wrap">        </span>21.,<span style="white-space:pre-wrap">        </span>4./)</div><div class="gmail_default">x := (/0,1,2,3,4/)</div><div class="gmail_default">colors := (/ (/0.972549,0,0/),(/0.533333,0.25098,0.12549/),(/0,0,0.972549/),(/0.972549,0.470588,0/),(/0.972549,0,0.972549/) /)</div><div class="gmail_default">bars := True</div><div class="gmail_default">bars@gsnXYBarChart = True</div><div class="gmail_default">bars@trYMinF = 0.</div><div class="gmail_default">bars@gsnXYBarChartColors := colors</div><div class="gmail_default">plot = gsn_csm_xy(wks,x, y, bars)</div><div><br></div><div><br></div></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"></div></div>
<br></div></div>_______________________________________________<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></div><br></div>
</div></div></blockquote></div><br></div>