<div dir="ltr">Dear Mary,<div><br></div><div>Thank you so much for your effort. This gives more extension of solutions to my problem. So nice.</div><div><br></div><div>Kindest regards,</div><div>-r/K-</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 18, 2016 at 12:14 AM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@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 class="gmail_default" style="font-size:small">As I attempted to fix the histogram problem, I realized there were a lot of changes to make to some internal code to handle the different types of color that can be input (index color, named colors, RGB colors, RGBA colors).<br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I've attached a new version of "utilities.ncl" and an internal "hist_columns" function that fixes the multiple colors issue. I included an example code to try the fix.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"> Save all three scripts and then run with:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><font face="monospace, monospace">ncl histo_bar_colors.ncl</font></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">This script uses the now-fixed "gsnHistogramBarColors", in which you can give it an array of colors whose dimensionality fits that with the number of bars you have and whether you are doing a compare.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">For example, if you have 2 sets of bars with 5 bars each, then you can provide a 2 x 5 array of index colors, named colors, or RGB/RGBA arrays to set the color for each bar:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">
<p><font face="monospace, monospace"> colors = (/(/"maroon4","firebrick","yellow","paleturquoise1","darksalmon"/),\<br> (/ "orange","forestgreen","tan3","navyblue","hotpink"/)/)</font></p>
<p><font face="monospace, monospace"> res@gsnHistogramBarColors = colors<span class="HOEnZb"><font color="#888888"><br></font></span></font></p></div><span class="HOEnZb"><font color="#888888"><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 16, 2016 at 11:10 AM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@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 class="gmail_default" style="font-size:small">Hi,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The gsn_histogram code needs to be cleaned up so it can handle color better. I'm looking into this and hope to have a fix.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The issue is trying to handle the different color types that can now come in:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"> - named colors ("red", "blue")</div><div class="gmail_default" style="font-size:small"> - indexed color (1, 3, 7)</div><div class="gmail_default" style="font-size:small"> - RGB color</div><div class="gmail_default" style="font-size:small"> - RGBA color</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Right now the code is assuming either RGB or indexed color AND it doesn't recognize the fact that you might have a second set of bars that you might want colored differently. It's not a bug, but just the way the code was implemented. It could be thought out better!</div><span><font color="#888888"><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 16, 2016 at 3:09 AM, rK Aditya <span dir="ltr"><<a href="mailto:aditya.rk@gmail.com" target="_blank">aditya.rk@gmail.com</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">Dear All,<div><br></div><div>Got it! I need to change gsn_code.ncl and introduce </div><div><br></div><div>gsres@gsFillColor = fillcolor(j) manually inside do j=nbarsinbin-1,0,1.<br></div><div><br></div><div>Cheers,</div><div>-r/K-</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 16, 2016 at 6:59 AM, rK Aditya <span dir="ltr"><<a href="mailto:aditya.rk@gmail.com" target="_blank">aditya.rk@gmail.com</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">Dear Guilherme,<div><br></div><div>Thank you for the suggestion. I tried to activate gsnXYBarChart toTrue as well, but gsnXYBarChartColors2 or gsnXYBarChartColors are not valid resources for this. I still could not change the color bar for the second field.</div><div><br></div><div>Kindest regards,</div><div>-r/K-</div><div><br></div><div><br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 16, 2016 at 2:08 AM, Guilherme Martins <span dir="ltr"><<a href="mailto:jgmsantos@gmail.com" target="_blank">jgmsantos@gmail.com</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">I'm note sure but try: <span style="margin:0px;padding:0px;font-size:14.6667px;line-height:17.3333px;font-family:verdana,arial,sans-serif;color:rgb(0,0,0)">gsnXYBarChartColors2 or </span><span style="margin:0px;padding:0px;font-size:14.6667px;line-height:17.3333px;font-family:verdana,arial,sans-serif;color:rgb(0,0,0)">gsnXYBarChartColors.</span><div><strong style="margin:0px;padding:0px;font-size:14.6667px;line-height:17.3333px;font-family:verdana,arial,sans-serif;color:rgb(0,0,0)"><br></strong></div><div><span style="margin:0px;padding:0px;font-size:14.6667px;line-height:17.3333px;font-family:verdana,arial,sans-serif;color:rgb(0,0,0)">Guilherme.</span></div></div><br><div class="gmail_quote"><div><div><div dir="ltr">Em dom, 15 de mai de 2016 às 16:11, rK Aditya <<a href="mailto:aditya.rk@gmail.com" target="_blank">aditya.rk@gmail.com</a>> escreveu:<br></div></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">Dear All,<div><br></div><div>I would like to compare histogram for two seasons; winter and summer. I use the first field for summer and put it with filled red color. But I could not change the color in the second field, on crosshatch pattern to other color, let say blue.</div><div><br></div><div>If someone can help me?</div><div><br></div><div>Thank you for your time.</div><div><br></div><div>Kindest regards,</div><div>-r/K-</div><div><br></div><div><br></div><div><div>begin</div><div>;************************************************</div><div>; Generate some random data.</div><div>;************************************************</div><div> x = new(1000,integer)</div><div> y = new(1000,integer)</div><div> do i=0,dimsizes(x)-1</div><div> x(i) = rand()</div><div> y(i) = rand()</div><div> end do</div><div> x = x/320</div><div> y = y/320</div><div><br></div><div>;************************************************</div><div>; Set up a variable to hold both x and y.</div><div>;************************************************</div><div> z = new((/2,dimsizes(x)/),integer)</div><div> z(0,:) = x</div><div> z(1,:) = y</div><div>;************************************************</div><div>; create plot</div><div>;************************************************</div><div> wks = gsn_open_wks("png","histo") ; send graphics to PNG file</div><div> gsn_define_colormap(wks,"temp1") ; choose colormap</div><div><br></div><div> res = True ; plot mods desired</div><div> res@gsnHistogramCompare = True</div><div> res@gsnHistogramBinIntervals = (/25,50,75/)</div><div>; res@gsFillColors = (/(/"blue","red"/),(/"blue","red"/)/)</div><div>; res@gsFillColor=(/"blue","blue","red","red"/)</div><div> res@gsnHistogramBarColors = (/(/"red","blue"/),(/"red","blue"/)/)</div><div>; res@gsnHistogramBarColors=(/"blue","blue","red","red"/)</div><div> plot=gsn_histogram(wks,z,res) ; create histogram</div><div>end</div></div><div><img src="cid:ii_154b5ccc8eabc337" alt="Inline image 1" width="481" height="481"></div></div></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><span><font color="#888888"><br>
</font></span></blockquote></div><span><font color="#888888"><div dir="ltr">-- <br></div><div dir="ltr"><div><font size="2"><div>------------------------------------------------------------------------------------------</div><div>Dr. Guilherme Martins</div><div>Instituto Nacional de Pesquisas Espaciais (INPE)<br></div></font></div><div><font size="2">Centro de Previsão de Tempo e Estudos Climáticos (CPTEC)<br></font>Grupo de Desenvolvimento em Assimilação de Dados (GDAD)<font size="2"><br></font></div><div>Telefone (INPE/CP): <a href="tel:%2B55%2012%203186-8551" value="+551231868551" target="_blank">+55 12 3186-8551</a> || Celular (TIM): <a href="tel:%2B55%2012%2098152-8580" value="+5512981528580" target="_blank">+55 12 98152-8580</a><br>E-mail: <a href="mailto:guilherme.martins@inpe.br" target="_blank">guilherme.martins@inpe.br</a> || <a href="mailto:jgmsantos@gmail.com" target="_blank">jgmsantos@gmail.com</a><br>Skype: guilherme.martins.<br>Homepage: <a href="https://sites.google.com/site/jgmsantos" target="_blank">https://sites.google.com/site/jgmsantos</a><br>Currículo Lattes: <a href="http://lattes.cnpq.br/5997657584785803" target="_blank">http://lattes.cnpq.br/5997657584785803</a><span><br></span>------------------------------------------------------------------------------------------</div></div>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></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>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>