【问题标题】:Histogram in GNUplot, each bar with a different colorGNUplot 中的直方图,每个条形都有不同的颜色
【发布时间】:2016-08-29 17:17:17
【问题描述】:

我正在尝试使用 GNUplot 制作条形图,每个条形图都有不同的颜色。我在手册中发现可以使用 lc rgbcolor 变量来完成。

我的数据文件夹是这样的,

ACB 0.106372
ASW 0.10909
BEB 0.110973
CDX 0.106577
CEU 0.102091
CHB 0.108829
CHS 0.110807
CLM 0.108803

我的剧情脚本如下,

set style histogram gap 2
set autoscale y

set style fill solid

set xtics rotate by 90 offset 0,-1.2


rgb(r,g,b) = 65536 * int(r*10) + 256 * int(g*10) + int(b*10)
set boxwidth .5

set output "Plot.eps" 
plot "plot.tsv" using 2:xticlabels(1):(rgb($2,$2,$2)) with boxes lc rgb variable

我使用了 GNUplot 手册中显示的 rgb 函数。但它显示以下错误。

plot "plot.tsv" using 2:xticlabels(1):(rgb($2,$2,$2)) with boxes lc rgb variable
                                                                                ^
         "#Plot.plt", line 18: x range is invalid

我无法弄清楚错误的含义。

请帮忙。

提前致谢。

【问题讨论】:

    标签: gnuplot histogram


    【解决方案1】:

    您实际上是在使用样式“框”而不是“直方图”进行绘图。这可能是您想要的,但是对于直方图,x 坐标是隐式的,对于框,您必须在第一列中提供 x 坐标,即使您可以使用序数 0、1、2、3、.. .

    所以 使用 0:2:xticlabels(1):(rgb($2,$2,$2)) 和框 lc rgb 变量绘制“plot.tsv”

    哦,您可能还想设置填充样式以使颜色可见: 设置样式填充实体

    【讨论】:

      猜你喜欢
      • 2012-07-24
      • 1970-01-01
      • 2017-08-28
      • 2012-08-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-04
      相关资源
      最近更新 更多