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


Groups > comp.graphics.apps.gnuplot > #2671

Re: change box colors in bar graph

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Ethan A Merritt <EAMerritt@gmail.com>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: change box colors in bar graph
Date Thu, 25 Dec 2014 12:22:33 -0800
Organization made entirely of Lego
Lines 41
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>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
Injection-Date Thu, 25 Dec 2014 20:22:14 +0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="7bbfccb08e3cb0f92ebf95516f5f5a81"; logging-data="31037"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Hdo9RpE8EDaXYHXI3eoO3"
User-Agent KNode/4.12.5
Cancel-Lock sha1:QvN+FIBAmf0h1zHYO7nsJDWxUMs=
Xref csiph.com comp.graphics.apps.gnuplot:2671

Show key headers only | View raw


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 | NextPrevious in thread | Find similar | Unroll thread


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