7

我正在尝试使用 gnuplot 可视化我拥有的数据集(在 Java 中,但这并不重要)。我可以问几个不同的问题,但现在:假设我的数据是分类的,对于每个类别,我有四分位数 1、2、3、最小值和最大值,以及该类别中样本的总权重(但不是实际样本数据)。我想用 GNUplot 'candlesticks' 来绘制它。我几乎可以得到这个:

“烛台”情节

除了使用框宽度可视化样本的重量。

这可以在 gnuplot '烛台' 情节中完成吗?还有什么办法?

注意:我最感兴趣的是用 gnuplot 来做这件事。仅当其他建议易于编写脚本并且不需要安装太多附加软件时,它们才会受到欢迎。

4

1 回答 1

14

好的,我知道了。

示例脚本:

set terminal pngcairo  transparent enhanced font "arial,10" fontscale 1.0 size 500,    350 
set output 'candlesticks.png'
set boxwidth 0.2 absolute
set title "Box-and-whisker plot with median bar, whiskerbars, and variable box width" 
set xrange[0:5]
set yrange[0:25]

# Data columns: X Min 1stQuartile Median 3rdQuartile Max BoxWidth Titles

# set bars 4.0
set style fill empty
plot 'data.txt' using 1:3:2:6:5:7:xticlabels(8) with candlesticks title 'Quartiles' whiskerbars, \
  ''         using 1:4:4:4:4:7 with candlesticks lt -1 notitle

样本内容data.txt

# Data columns: X Min 1stQuartile Median 3rdQuartile Max BoxWidth Titles
1 5 7 10 15 24 0.3 Quick
2 6 8 11 16 23 0.4 Fox
3 5 7 11 17 22 0.5 Lazy
4 6 9 10 18 21 0.3 Dog

(请注意,#行只是注释,我们并没有真正指定列名。)

结果:

阴谋

于 2013-03-14T08:37:06.980 回答