Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #2670 > unrolled thread

Re: change box colors in bar graph

Started bywadud.miah@gmail.com
First post2014-12-24 04:34 -0800
Last post2014-12-25 12:22 -0800
Articles 2 — 2 participants

Back to article view | Back to comp.graphics.apps.gnuplot

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

#2670 — Re: change box colors in bar graph

Fromwadud.miah@gmail.com
Date2014-12-24 04:34 -0800
SubjectRe: change box colors in bar graph
Message-ID<d5aebb8c-defe-4fee-801f-d93d1a36a6ce@googlegroups.com>
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. 

[toc] | [next] | [standalone]


#2671

FromEthan A Merritt <EAMerritt@gmail.com>
Date2014-12-25 12:22 -0800
Message-ID<m7hrll$u9t$1@dont-email.me>
In reply to#2670
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web