增加聚类条形图中的xtic之间的间距(直方图)

时间:2014-02-20 06:16:30

标签: gnuplot

很抱歉,如果这看起来像是一个简单的问题(可能),但我搜索了一些无效的解决方案。

我在这里绘制了如附图所示的条形图。我的问题是调整每个xtic标签之间的间距,彼此重叠。如果你注意到我附在这里的条形图,在x轴上,“第三个标签”和“第四个标签长”相互重叠。反正是否控制间距以使标签不重叠?另外,我需要图例(ring1,ring2和ring12)用斜体字表示。由于我使用的是“终端pngcairo”,有没有办法用斜体字来表示?

set terminal pngcairo size 550,350 enhanced dash
set output "xplot_ACF_ring1-ring2-head-plots2.png"

set macro
labelFONT="font 'arial,22'"
scaleFONT="font 'arial,12'"
scaleFONT2="font 'helvetica,13'"
keyFONT="font 'arial,18'"
########################################################################################

set ylabel "Time in (ns)"           @labelFONT
set ytic                    @scaleFONT 
set xtic scale 0                @scaleFONT
set size 1.0, 1.0

########################################################################################
ring1 = "#ff0000"; ring2 = "#7FFF00"; ring12 = "#0000FF"
set auto x
set yrange [65:90]
set style data histogram
set style histogram cluster gap 1.5
set style fill solid 1.0 border -1
set boxwidth 0.9 relative
plot 'mal-cel-iso-bcm-ring1-ring2-head-bar-plot2.dat' using 2:xtic(1) ti col fc rgb ring1 ,\
     '' u 3 ti col fc rgb ring2 ,\
     '' u 4 ti col fc rgb ring12

上述脚本的数据是

Title         "ring1"   "ring2"     "ring12"
"First label"     70        76      77
"Second label"    68        71      69
"Third label"     76        72      68
"Fourth label long"   75        76      77

下面是执行脚本后得到的图表。 enter image description here

这篇文章的重新编辑从这里开始:

我想在此图中添加错误栏。样本数据如下:

Title   "ring1"         "ring2"         "ring12"
""      77.295326   2.2 74.829245   3.2 78.238016   2.1
""      77.613533   6.2 74.123269   1.5 79.704782   3.6
""      76.589653   2.1 71.704465   2.6 78.736618   4.2
""      75.996256   0.4 73.407460   3.3 77.290057   2.5

第三列和第七列实际上是错误值。

我希望可以提前感谢。

3 个答案:

答案 0 :(得分:3)

解决问题的另一种方法是使用以下方式旋转标签:

set xtics rotate out

或者如果您想指定轮换:

set xtics rotate by -45

答案 1 :(得分:2)

没有明确的选项可以防止标签重叠。

在您的示例中,使用

将左边和右边的边框的白色间距减少一点就足够了
set offset -0.3,-0.3,0,0

为您提供版本4.6.3:

enter image description here

其他选项例如。

  • 增加画布大小(set terminal ... size ...)。请注意,set size不会影响图片大小,只会影响图表的大小。

  • 对于很长的标签,您可以旋转文字,例如与set xtic rotate ...

答案 2 :(得分:0)

只需设置偏移量:

set offsets <left>, <right>, <top>, <bottom>

您还可以找到以下有用的命令:

unset offsets
show offsets

请记住,偏移可以是常量或表达式

还记得在splot s中忽略了偏移量。

相关问题