Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #2671
| From | Ethan A Merritt <EAMerritt@gmail.com> |
|---|---|
| Newsgroups | comp.graphics.apps.gnuplot |
| Subject | Re: change box colors in bar graph |
| Date | 2014-12-25 12:22 -0800 |
| Organization | made entirely of Lego |
| Message-ID | <m7hrll$u9t$1@dont-email.me> (permalink) |
| References | <62eb292f-625d-45a9-aeae-05ac9bc44d63@s25g2000prd.googlegroups.com> <d5aebb8c-defe-4fee-801f-d93d1a36a6ce@googlegroups.com> |
wadud.miah@gmail.com wrote:
> On Wednesday, 10 February 2010 18:04:21 UTC, mikegnubie wrote:
>> I am relatively new to gnuplot and I'm trying to plot a bar graph
>> with boxerrorbars such that the color of the box depends on the value
>> of a
>> certain variable. If the variable is greater than 20, for example,
>> the bar will be blue, but if less than 20, the bar will be light
>> blue. Is there any way to control the color of the bars in this
>> fashion using boxerrorbars?
>>
>> Also, I would like to change the color of the error bars in a similar
>> fashion: if a given variable is greater than, say, 50, the error bar
>> should be red, but black otherwise.
>>
>> Thanks,
>>
>> Mike
>
> I think I am trying to do something similar. I want the bar chart
> colour to be a certain if positive and another colour if negative.
> Here is my code:
>
> plot 'lcals_lambda.dat' using 2:xtic(1) title "gmond off" axes x1y1 linecolor rgb "#006400", \
> 'lcals_lambda.dat' using 3:xtic(1) title "gmond on" axes x1y1 linecolor rgb "#00FFFF", \
> 'lcals_lambda.dat' using (abs($4)):($4>= 0 ? 0x00FF00 : 0xFF0000) title "perf diff" axes x1y2 linecolor
> rgb variable
>
> It is the last line that I am interested in which does not work and
> simply colours it black regardless if the value is positive or
> negative. Any help will be greatly appreciated.
I think you want
DAT = 'lcals_lambda.dat'
set style data boxes
plot DAT using 1:2:xtic(1) title "gmond off" lc rgb "#006400", \
DAT using 1:3:xtic(1) "gmond on" lc rgb "#00FFFF", \
DAT using 1:(abs($4)):($4>= 0 ? 0x00FF00 : 0xFF0000) title "perf diff" axes x1y2 lc rgb variable
Back to comp.graphics.apps.gnuplot | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: change box colors in bar graph wadud.miah@gmail.com - 2014-12-24 04:34 -0800 Re: change box colors in bar graph Ethan A Merritt <EAMerritt@gmail.com> - 2014-12-25 12:22 -0800
csiph-web