[ncl-talk] horizontal (floating) bar chart: changing individual label colors and using gsnXRefLine to indicate the average of each bar?

Adam Phillips asphilli at ucar.edu
Mon Mar 6 13:33:55 MST 2017


Hi Maria,
With regards to the tmYRLabelFontColor not working: I believe it actually
is working as it is intended. You can only specify one color for the entire
set of axis colors. As slate blue is the color you selected for the base
plot labels, that is the color you will see for all the labels. (The other
colored labels for each iteration is overwritten by the labels/colors
chosen for the base plot.)

One way to solve this issue is to draw each item separately each time
through the loop without overlaying. This would allow one to only turn on
the one Y-axis label (with the right color) they want each time through the
do loop. The negative to this approach is that you cannot maximize the plot
on the frame using gsnMaximize or maximize_output. However, you can play
with the vp* resources to get the plot to be as big within the frame as
you'd like.

With regards to your XRefLine query: I do not think it is possible to do
what you were asking, as in limit the range of the X-axis reference line.
However, it is quite possible to add these lines using gsn_polyline.

I have modified your script as noted above, and attached both the script
and the output .png. Hopefully the modifications all make sense.
Adam

On Mon, Mar 6, 2017 at 7:47 AM, Rugenstein Maria <
maria.rugenstein at env.ethz.ch> wrote:

> Hi all,
>
> I’m trying to ascribe the same color to the bar and its label in a
> horizontal (floating) bar chart.
>
> colors = (/“red”,”blue”,”green”/)
> do i=0,nbars-1
>   res at gsnXYBarChartColors = colors(i)   <=========== works
>   res at tmYRLabelFontColor = colors(i)            <=========== doesn’t work
>>   overlay(base_plot,max_plot(i))
> end do
>
> Further, I'm wondering how to make use of the gsnXRefLine resource to
> indicate the average of each bar with a dot or a line. Is there any way to
> either shrink the gsnXRefLine down to the individual bar itself or have the
> whole RefLine transparent everywhere except black within its specific bar?
> Or do I have to parse all the different gsnXRefLines for each bar to
> individual polymarkers?
>
> Attached my script — it’s a close variation of your example
> bar_horz_13.ncl and produces the pdf plot, which is attached as well.
>
> Thanks for helping out!
> Maria
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726 <(303)%20497-1726>

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170306/55d5dcdf/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bar_horz_13_variation.2.ncl
Type: text/x-ncl
Size: 4876 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170306/55d5dcdf/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: horizontal_bar_chart_variation.png
Type: image/png
Size: 24047 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170306/55d5dcdf/attachment.png 


More information about the ncl-talk mailing list