gnuplot x标签在直方图中的位置 [英] gnuplot x label position in histogram

查看:96
本文介绍了gnuplot x标签在直方图中的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下数据:

t_4 24 3 0 0
t_6 37 4 0 0
t_8 51 4 2 0 

t_4 15 1 0 0
t_6 21 0 0 1
t_8 30 0 0 1

t_4 13 2 1 0
t_6 20 3 1 0
t_8 22 4 1 0

并且我尝试制作类似于此 http的直方图://www.bmsc.washington.edu/people/merritt/gnuplot/stack+cluster.dem ,其中包含以下修改的代码版本:

and i try to make an histogram similar to this http://www.bmsc.washington.edu/people/merritt/gnuplot/stack+cluster.dem , with this modify version of the code:

set style data histogram
set style histogram rowstacked
set style fill solid
set boxwidth 0.5
set key invert samplen 0.2
set key samplen 0.2
set bmargin 3
set offset 0,2,0,0

set title "number of multiple resonances"

plot newhistogram "1:j" lt 1, \
     'stack+cluster.dat' index 0 u 2:xtic(1) title "one", \
     '' index 0 u 3 title "two", \
     '' index 0 u 4 title "three", \
     '' index 0 u 5 title "four"

     newhistogram "2:j" lt 1, \
     'stack+cluster.dat' index 1 u 2:xtic(1) notitle, \
     '' index 1 u 3 notitle, \
     '' index 1 u 4 notitle, \
     '' index 1 u 5 notitle

      newhistogram "3:j" lt 1, \
     'stack+cluster.dat' index 1 u 2:xtic(1) notitle, \
     '' index 1 u 3 notitle, \
     '' index 1 u 4 notitle, \
     '' index 1 u 5 notitle

但这是我发现的输出

您可以看到问题出在x标签名称newhistogram "1:j""2:j""3:j"上:我只能看到"1:j"并与"t_4 ..."重叠.

As you can see the problem is in the x labels names newhistogram "1:j" , "2:j" and "3:j" : i can see only "1:j" and overlapped with the "t_4...".

请问有人可以帮我吗?

推荐答案

该脚本给出了错误!所有命令必须属于一个plot命令.如您所愿,脚本将在第二个newhistogram之前终止.

That script gives an error! All commands must belong to a single plot commands. As you have it, the script terminates before the second newhistogram.

接下来的事情是,您需要用两个空白行分隔两个空格,以便使用index参数对其进行寻址(有关此信息,另请参见数据文件 http://www.bmsc.washington.edu/people/merritt/gnuplot /stack+cluster.dat 属于您所讨论的示例).

The next thing is, that you need to separate two blocks with two blank lines in order to address them with the index parameter (for this see also the comments in the data file http://www.bmsc.washington.edu/people/merritt/gnuplot/stack+cluster.dat which belongs to the example you talked about).

通过这些更正,您将获得以下脚本(另请注意title offset):

With these corrections you get the following script (note also the title offset):

set style data histogram
set style histogram rowstacked title offset 0,-1
set style fill solid
set boxwidth 0.5
set key invert samplen 0.2
set key samplen 0.2
set bmargin 3
set offset 0,2,0,0

set title "number of multiple resonances"

plot newhistogram "1:j" lt 1, \
     'stack+cluster.dat' index 0 u 2:xtic(1) title "one", \
     '' index 0 u 3 title "two", \
     '' index 0 u 4 title "three", \
     '' index 0 u 5 title "four",\
     newhistogram "2:j" lt 1, \
     'stack+cluster.dat' index 1 u 2:xtic(1) notitle, \
     '' index 1 u 3 notitle, \
     '' index 1 u 4 notitle, \
     '' index 1 u 5 notitle,\
      newhistogram "3:j" lt 1, \
     'stack+cluster.dat' index 1 u 2:xtic(1) notitle, \
     '' index 2 u 3 notitle, \
     '' index 2 u 4 notitle, \
     '' index 2 u 5 notitle

带有结果(带有4.6.5):

with the result (with 4.6.5):

这篇关于gnuplot x标签在直方图中的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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