does the following script produce the plot you want?
(change 'nw' for the actual number of weeks)
data:
data R1 S1 R2 S2 R3 S3 R4 S4 R5 S5
line1 1000 0.1 900 0.2 800 0.3 700 0.4 600 0.5
line2 900 0.1 800 0.2 700 0.3 600 0.4 500 0.5
line3 800 0.1 700 0.2 600 0.3 500 0.4 400 0.5
line4 700 0.1 600 0.2 500 0.3 400 0.4 300 0.5
line5 600 0.1 500 0.2 400 0.3 300 0.4 200 0.5
script:
set macros
nw=5 ; # number of weeks
gs="1" ; # gap between clusters
b=1./(nw+@gs)
o=-0.5*(nw-1)*b
w = nw-1
set xrange [0:6]
set yrange [0:1050]
set style histogram clustered gap @gs
set style data histogram
plot \
for [i=0:w] 'data.txt' using (column(2+i*2)):xticlabels(1) title
columnheader,\
for [i=0:w] '' using ($0+1):(column(2+i*2)):(stringcolumn(3+i*2)) \
every ::1 \
with labels center offset first o+i*b, graph 0.01 notitle
dave101 wrote:
>
> Say I have 5 manufacturing lines. Each week, I collect 2 quality metrics
> R and S. After week 2, I have a table like below. I would like to graph
> a clustered histogram chart using the data from the R# columns and then
> put the number from the corresponding S# column above each bar.
>
> So far I have below which can plot the S# points, but i can't make it just
> put the S numbers and all of the S# points get put on the first bar in the
> cluster, not on each bar in the cluster. (i.e. I need to use a separate
> xtic for each S#.
>
> I need the solution to be scalable -- each week I will add 2 new columns
> for R and S. So I need to be able to calculate the xtics somehow based on
> number of columns?
>
> plot "data.txt" using 2:xticlabels(1) ti col , '' using 4 ti col, '' using
> 3 ti col axis x1y2 with points, '' using 5 ti col axis x1y2 with points
>
> data R1 S1 R2 S2
> line1 1000 0.2 900 0.1
> line2 900 0.2 800 0.1
> line3 800 0.2 700 0.1
> line4 700 0.2 600 0.1
> line5 600 0.2 500 0.1
>
>
--
View this message in context: http://old.nabble.com/Plot-value-from-another-column-above-histogram-bar-tp31652478p31654616.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|