Gnuplot 更改直方图中条的颜色

标签 gnuplot histogram

是否可以动态更改 Gnuplot 脚本中条的颜色?
我有以下脚本

reset
fontsize = 12
set term postscript enhanced eps fontsize
set output "bargraph_speedup.eps"
set style fill solid 1.00 border 0
set style histogram
set style data histogram
set xtics rotate by -45
set grid ytics linestyle 1
set xlabel "Benchmarks" font "bold"
set ylabel "Relative execution time vs. reference implementation" font "bold"
set datafile separator ","
plot 'bm_speedup.dat' using 2:xtic(1) ti "Speedup" linecolor rgb "#00FF00"

生成这个图:

Generated plot

是否可以将低于零的条的颜色设为红色?

谢谢,
斯文

最佳答案

您可以使用 boxes 模仿这种行为。风格:

我的测试数据:

zip 2
baz 2
bar -1
cat 4
foo -3

然后用 gnuplot 绘图:
set style line 1 lt 1 lc rgb "green"
set style line 2 lt 1 lc rgb "red"
set style fill solid
plot 'test.dat'  u (column(0)):2:(0.5):($2>0?1:2):xtic(1) w boxes lc variable
#                  #xval:ydata:boxwidth:color_index:xtic_labels

关于Gnuplot 更改直方图中条的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12224545/

相关文章:

linux - gnuplot - 两个图的交集

ubuntu - 为什么 gnuplot 4.6 绘图窗口没有 Gnuplot 4.4 的功能?

c - Gnuplot : Hide the window

string - gnuplot - 使用字符串变量

java - 如何制作绩效数字的直方图

r - 格直方图轴 : how to fix lower limit at 0, 但保持默认上限?

带有误差条的 Matplotlib 直方图

gnuplot - gnuplot 可以计算并绘制连续数据点之间的增量吗

随机分布数据的Matlab直方图

R - hist(XX, plot=FALSE)$count 的更快替代品