Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #2012
| Newsgroups | comp.graphics.apps.gnuplot |
|---|---|
| Date | 2013-09-01 11:22 -0700 |
| Message-ID | <d7c91259-2e16-470f-83fe-2cdce8ac1e0f@googlegroups.com> (permalink) |
| Subject | histogram bar colors |
| From | bryan <bryanlepore@gmail.com> |
[ gnuplot 4.6 patchlevel 0 - yes I can upgrade this ASAP]
[ Ubuntu 12.04.3 LTS ]
[ misc downstream programs]
I am wondering how to color particular bars a different color than a default. my working script and data to plot fractions as a histogram is copy/pasted below. AFAIK a rather general histogram setup is employed. but specifically, the script uses:
plot 'test_01sep13a.dat' u 3:xticlabel(1)
to actually plot the data.
in the example, there are two particular bars that should be at 500 and 1000 in some alternate color. so the output plot would, for example, have all the bars for the fruit (see data) in the color red, and the bars for the numbers (500 and 1000) black. the idea is the bars for the numbers would stand out. FYI this is to connect the fractional value with the count ("how many") value.
this script appears to be close to what I am looking for:
http://gnuplot.sourceforge.net/demo/histograms.2.gnu
but the data is plotted in a different way... I admit I could learn more about the above syntax I am already using.
here's the script and data:
-------------------------------------------------------
set title "compare fruit categories"
set xtics 1 out
set grid
set key left top
unset label
set format y "%3.3f"
set xlabel "category" ; set ylabel "fraction " rotate by -90
set style data histogram
set style fill solid border -1
set style histogram
set xtics nomirror rotate by -90
set ytics rotate by -90
set bars back
plot 'test_01sep13a.dat' u 3:xticlabel(1) notitle
#------------------------------------------------------------------------
#test_01sep13a.dat:
banana 53.08 0.000396244
apple 160 0.00119441
500 500 0.00373252
lemon 804.65 0.00600674
tangerine 956.77 0.00714233
kiwi 977.38 0.00729618
1000 1000 0.00746504
starfruit 1022.31 0.00763158
orange 1061.76 0.00792608
#------------------------------------------------------------------------
Back to comp.graphics.apps.gnuplot | Previous | Next — Next in thread | Find similar | Unroll thread
histogram bar colors bryan <bryanlepore@gmail.com> - 2013-09-01 11:22 -0700
Re: histogram bar colors sfeam <sfeam@users.sourceforge.net> - 2013-09-01 16:46 -0700
Re: histogram bar colors bryan <bryanlepore@gmail.com> - 2013-09-01 19:31 -0700
Re: histogram bar colors sfeam <sfeam@users.sourceforge.net> - 2013-09-03 12:40 -0700
csiph-web