Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: sfeam Newsgroups: comp.graphics.apps.gnuplot Subject: Re: histogram bar colors Date: Tue, 03 Sep 2013 12:40:48 -0700 Organization: gnuplot development team Lines: 35 Message-ID: References: <167f9dc7-6782-47f9-bf5f-c3f17e1d85c5@googlegroups.com> Reply-To: sfeam@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit Injection-Date: Tue, 3 Sep 2013 19:40:48 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="8e86a57dfa599721f116da4577f3d1af"; logging-data="1285"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Nz0DfJEdHmupuLam3DtbD" User-Agent: KNode/4.10.5 Cancel-Lock: sha1:D624JQbYpoyaiBv6zEpQZMttHf4= Xref: csiph.com comp.graphics.apps.gnuplot:2019 bryan wrote: > On Sunday, September 1, 2013 7:46:22 PM UTC-4, sfeam wrote: >> It will be easier to show "with boxes". >> >> Add the following lines to your script: >> >> barcolor(n) = strstrt(strcol(n), "0") ? 2 : 3 >> >> set boxwidth 0.2 absolute >> >> and replace the plot command with >> >> plot 'test_01sep13a.dat' u 0:3:(barcolor(1)):xticlabel(1) \ >> >> with boxes fillcolor variable notitle >> >> The key point here is to specify "fillcolor variable", > > thats interesting, and precisely what I was looking for - thanks a lot. > also seems to be a good reason to get the latest patchlevel. Oops, I had forgotten that some versions had a bug in recognizing the "fillcolor variable" keyword. Here is a slight variation that should work also on older gnuplot versions starting from 4.4. barcolor(n) = strstrt(strcol(n), "0") ? 0xff0000 : 0x0000ff plot 'test_01sep13a.dat' u 0:3:(barcolor(1)):xticlabel(1) \ with boxes notitle lt rgb variable The two colors in question are specified as 24-bit RGB colors in hexadecimal form, pure red and pure blue in this case. Ethan