Gnuplot:如何创建多个x标签

Gnuplot:如何创建多个x标签

问题描述:

是否可以使用Gnuplot在一个图中有多个x标签?Gnuplot:如何创建多个x标签

我的数据文件看起来像:

A dog 10 
A cat 20 
A fish 14 
B dog 15 
B cat 44 
B fish 5 

所需的输出,是这样的:

dog | cat | fish | dog | cat | fish 
     A   |  B 

任何想法?

+0

第三列是y值 – waseq 2013-04-17 08:18:45

假设你的数据文件格式是你的控制之下,你可能要你改变你的数据文件看起来像这样:

dog 10 15 
cat 20 44 
fish 14 5 

下面的脚本应该给你你想要的东西:

set style histogram cluster gap 2 
set boxwidth 1.5 
unset xtics 
set ytics 
set auto y 
plot newhistogram "A", 'data.dat' using 2:xtic(1) \ 
newhistogram "B", '' u 3:xtic(1) 

不正是你所要求的,但如果你的数据格式是这样的:

infile

Label  dog cat fish 
A   10 20 14 
B   15 44  5 

你可以得到相当接近:

set yrange [0:50] 
set style data histogram 
plot for [col=2:4] 'infile' using col:xtic(1) title columnheader fs solid .3 

Result of plot command