set term postscript eps
set output "result.eps"
set style data histogram
set style histogram rowstacked
set style fill solid 0.5
set boxwidth 1 relative
set xrange [0:31]
set xtics 1
set yrange [0:15]
set ytics 1
set title 'Studying time in May'
datafile = '../data/hour_formatting/May_formatted.txt'
data_under = '../data/under_ave/May_under.txt'
plot datafile using 2:xtic(1) with boxes title 'Studying time', data_under using 2:xtic(1) with boxes notitle fillcolor 'red''
In data_under, there is the data that 0 value only for above average value.
But the graph all colored with gray color.
I want to color only for the value below the average value. What is the problem, and how can I solve it?
I don't know what is the problem, so I cannot tried anything.
Ethan already gave the hint about color in postscript terminal. See also this question.
It looks like you have used some software tool to split your data into above and below average. Let me make a suggestion how you can simply do it with gnuplot from one single file (or datablock) containing your data, i.e. study time in hours per day of a certain month.
Script:
### show bar chart with differently colored bars below average
reset session
# create some random test data
set table $Data
set samples 30
plot '+' u ($0+1):(rand(0)*9 * int(rand(0)+0.8)) w table
unset table
stats $Data u 2 nooutput
myColor(v) = v < STATS_mean ? 0xff0000 : 0xcccccc
set style fill solid 1.0 border lt -1
set xrange[0:32]
set xtics out
set ylabel "studying time in hours"
plot $Data u 1:2:(myColor($2)):xtic(1) w boxes lc rgb var notitle, \
STATS_mean w l dt 2 lc "black" ti "average"
### end of script
Result: