<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Rashed,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The differences you are seeing in colorbar_test.ncl is due to the fact that gsnSpreadColors operates on whatever color map is associated with the workstation, and since the the workstation color map uses 0 and 1 as the background and foreground colors, gsnSpreadColors always starts at color index 2.</div><div class="gmail_default" style="font-size:small"><br></div>When you do this kind of call<div class="gmail_default" style="font-size:small;display:inline">, however:</div><br><br> colors = span_color_rgba(cmap,nlevels+1)<div><div class="gmail_default" style="font-size:small;display:inline"><br></div></div><div><div class="gmail_default" style="font-size:small;display:inline">the function </div>will return a span of the <div class="gmail_default" style="font-size:small;display:inline">whole</div> color map, including the first two colors (which you defined as white and black respectively). <br></div><div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You can get gsnSpreadColors to behave the same way as span_color_rgba, by telling gsnSpreadColors to start at index 0 instead of index 2:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">res@gsnSpreadColorStart = 0</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You're right though, you should use cnFillPalette in place of gsnSpreadColors.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks for providing sample scripts that explained your issue.<br></div><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><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 4, 2018 at 12:53 PM, Rashed Mahmood <span dir="ltr"><<a href="mailto:rashidcomsis@gmail.com" target="_blank">rashidcomsis@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 just realized that gsn_SpreadColors is deprecated in NCL 6.1 and later.<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 3, 2018 at 7:49 PM, Rashed Mahmood <span dir="ltr"><<a href="mailto:rashidcomsis@gmail.com" target="_blank">rashidcomsis@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"><div>Hi all,</div><div><br></div><div>It seems that there is a possible issue (may be a previously known one) when using "gsnSpreadColors" resource. There is difference of one color between colorbar of a map plot and manual creation of colorbar with same levels and colors.</div><div><br></div><div> The attached simple script "colorbar_test.ncl" creates dummy data and runs "as is". The top two lines and the following two can be turned on and off to create attached fig_1 and fig_2, each containing two colorbars one for map (upper one) and one for coloured markers (lower one). For fig_1 the colorbars are same (from 0 to onwards) however in fig_2 the central color is different. The only difference for plotting these is the number of levels (odd or even).<br></div><div><br></div><div></div><div>As a test, when I used same script using "cnFillPalette", in attached script named "No_problem_script.ncl", the colorbars are exactly same for both contour levels. The "no problem" figures are also attached.</div><div><br></div><div>I think this is related to how the colours are spanned in two routines "gsnSpreadColors" and "cnFillPalette", but still it is surprising to see the differences in colorbars of fig_1 and fig_2.</div><div><br></div><div><br></div><div></div><div>Any thoughts on this would be appreciated. I should now be using "cnFillPallette", always!<br></div><div><br></div><div>Cheers,</div><div>Rashed<br></div><div> <br></div></div>
</blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>