GNUPLOT每个直方图酒吧用不同的颜色 [英] GNUPLOT Each Histogram Bar with different color

查看:2460
本文介绍了GNUPLOT每个直方图酒吧用不同的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示的不同颜色的位图文件的量。

I want to visualize the amount of different colors of a bitmap file.

我的数据表如下:

1 163073164
4 185122087
3 255242000
8 255255255
3 000162232
1 181230029
1 127127127
1 136000021
3 200191231

我想通过使用GNU这个图的风格绘制自己的颜色每种颜色吧。

I want to draw each color bar with its own color by using gnu plot histogram style.

我只是尝试一些东西,通过使用LC变量,但它不工作。 : - (

I just try something out by using "lc variable" but it doesnt work. :-(

我GNUPLOT现在脚本:

My GNUPLOT script by now:

set style data histograms 
set boxwidth 1
set grid
set style histogram cluster gap 0  
set style fill solid 1.0 border -1
set yrange [0:*]
set xrange [0:*]
set xtics border in scale 0,10  nomirror rotate by -45  offset character 0, 0, 0 left
plot "histo.dat" using 1:xticlabels(2) lc variable no title
#EOF

我有此错误消息:

I've got this error message:

gnuplot> plot "histo.dat" using 1:xticlabels(2) lc variable no title
                                              ^
         "histo.plt", line 9: Bad data on line 1

任何人都可以给我一个提示或正确的命令?

Can anybody give me a hint or the correct commands?

最好的问候罗伯特

推荐答案

有趣的问题。我设法使它工作使用的风格,而不是您最初使用直方图的风格。我不认为应该让太多,但有差别的:

Nice question. I've managed to make it work using the boxes style as opposed to the histogram style you were originally using. I don't think that should make too much of a difference though:

set boxwidth 1
set grid
set style fill solid 1.0 border -1
set yrange [0:*]
set xrange [-.5:*]
set xtics border in scale 0,10  nomirror rotate by -45  
plot "histo.dat" using ($0):1:($0):xticlabels(2) w boxes lc variable notitle
                        #^boxes centered on 0,1,2,3,....
                           #^data column
                              #^ linecolor column.  first box has linecolor corresponding to ls 0, second box has linecolor corresponding to ls 1, etc ...
                                   #^ xticlabels (apparently) come last.

如果您不熟悉伪列0,这是(基本上)在数据文件中的行号。我通常不张贴这些东西的输出,但是这让人非常丰富多彩的情节!

If you're unfamiliar with pseudo-column 0, it is (essentially) the line number in the datafile. I don't usually post the output of these things, but this makes one very colorful plot!

这篇关于GNUPLOT每个直方图酒吧用不同的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆