gnuplot 直方图:如何在条形图上方偏移旋转的字符串
gnuplot histogram: how to offset rotated string above bars
对于直方图,我试图在条形顶部上方显示一个旋转的字符串。
我找到了在条形顶部显示 value 的帖子并且使用该技术有效 - 但旋转的 string 居中在栏的顶部,因此延伸到栏中,我希望它完全在栏外。
有没有办法按字符串长度进行偏移?
对于数据 ala
01/06 4 label1
01/07 5 label2
01/08 3 label3
以下全部失败
plot 'test.dat' using 2:xtic(1) with histogram, '' using 0:2:3 with labels rotate by 90 offset char 0,
plot 'test.dat' using 2:xtic(1) with histogram, '' using 0:2:3 with labels rotate by 90 offset char 0,strlen()
plot 'test.dat' using 2:xtic(1) with histogram, '' using 0:2:3 with labels rotate by 90 offset char 0,strlen(sprintf("%s", ))
勾选help labels
。然而,据我所知,选项没有明确提到,但如果你检查 help label
,你会看到选项 left|center|right
。
例如:
代码:
### histogram with string label
reset session
$Data <<EOD
01/06 4 "short label"
01/07 5 "a medium label"
01/08 3 "a pretty long label"
01/09 1 "and here now the longest label"
EOD
set style fill solid 0.3
set yrange[0:]
set offsets 0,0,2,0 # left,right,top,bottom
plot $Data u 2:xtic(1) w histogram, \
'' u 0:2:3 w labels rotate by 90 left offset 0,0.5
### end of code
结果:
对于直方图,我试图在条形顶部上方显示一个旋转的字符串。
我找到了在条形顶部显示 value 的帖子并且使用该技术有效 - 但旋转的 string 居中在栏的顶部,因此延伸到栏中,我希望它完全在栏外。
有没有办法按字符串长度进行偏移?
对于数据 ala
01/06 4 label1
01/07 5 label2
01/08 3 label3
以下全部失败
plot 'test.dat' using 2:xtic(1) with histogram, '' using 0:2:3 with labels rotate by 90 offset char 0,
plot 'test.dat' using 2:xtic(1) with histogram, '' using 0:2:3 with labels rotate by 90 offset char 0,strlen()
plot 'test.dat' using 2:xtic(1) with histogram, '' using 0:2:3 with labels rotate by 90 offset char 0,strlen(sprintf("%s", ))
勾选help labels
。然而,据我所知,选项没有明确提到,但如果你检查 help label
,你会看到选项 left|center|right
。
例如:
代码:
### histogram with string label
reset session
$Data <<EOD
01/06 4 "short label"
01/07 5 "a medium label"
01/08 3 "a pretty long label"
01/09 1 "and here now the longest label"
EOD
set style fill solid 0.3
set yrange[0:]
set offsets 0,0,2,0 # left,right,top,bottom
plot $Data u 2:xtic(1) w histogram, \
'' u 0:2:3 w labels rotate by 90 left offset 0,0.5
### end of code
结果: