gnuplot的 - 不同长度的水平关键标题排列 [英] gnuplot - alignment of horizontal key titles of different length

查看:754
本文介绍了gnuplot的 - 不同长度的水平关键标题排列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在横放,显然是由于不同的长度在片头我有困难的重点不同标题的对齐方式。

I am having difficulty with the alignment of the different key titles when placed horizontally, apparently due to the differing lengths in the titles.

有两个短畦冠军(第1和第4)和两个较长的冠军(第2和第3),离开最后两个冠军之间有较大的差距(presumably,因为它是设置它们之间的差距由相同的最大字符串长度)。我已经搜查,但没有发现任何办法改变这一点。

Having two short plot titles (1st and 4th) and two longer titles (2nd and 3rd) it leaves a larger gap between the final two titles (presumably as it is setting the gaps between them all by the same maximum string length). I have searched but found no way to alter this.

一个简化的例子如下所示。任何建议或帮助将是很大的AP preciated。

A simplified example is shown below. Any suggestions or help would be greatly appreciated.

set terminal postscript eps size 5.12,2.3 enhanced color "Helvetica" 12
set output 'example.eps'

set title 'Difficulty of Long and Short Title usage in Horizontal Keys' font "Helvetica, 20"

set key inside bottom center horizontal font "Helvetica, 20" width 1.8

set ylabel 'ylabel' font "Helvetica, 20" 
set xlabel 'xlabel' font "Helvetica, 20"  
set lmargin screen 0.10
set rmargin screen 0.95
set yrange [-1.5:1.5]

plot sin(x) title 'short', \
cos(x) title 'long title 1', \
-0.5 title 'long title 2', \
0.5 title 'short' w l ls 4

其结果是:

The result is:

推荐答案

一个可能的解决方法,这将是产生前三个图形,最后一个与两个不同的剧情命令在的multiplot 模式:

One possible workaround for this would be to generate the first three graphs and the last one with two different plot commands in multiplot mode:

set terminal postscript eps size 5.12,2.3 enhanced color "Helvetica" 12
set output 'example.eps'

set title 'Difficulty of Long and Short Title usage in Horizontal Keys' font "Helvetica, 20"

set ylabel 'ylabel' font "Helvetica, 20" 
set xlabel 'xlabel' font "Helvetica, 20"  
set lmargin screen 0.10
set rmargin screen 0.95
set yrange [-1.5:1.5]

set bmargin screen 0.15
set tmargin screen 0.9

set multiplot
set key horizontal font "Helvetica, 20" width 1.8 at graph 0.4, graph 0.1 center maxrows 1
plot sin(x) title 'short', \
     cos(x) title 'long title 1', \
     -0.5 title 'long title 2'

unset title
unset xlabel
unset ylabel
unset border
unset tics
set key horizontal font "Helvetica, 20" width 1.8 at graph 0.84, graph 0.1 center maxrows 1
plot 0.5 title 'short' w l ls 4
unset multiplot

不过,这需要一些调整:

However, this requires some tweaking:

  • 第二个剧情您必须删除标题,标签,抽搐和边境之前,否则图形看起来是因为不同的抗混叠锯齿状
  • 要拥有你还必须设置固定相同的利润率 tmargin的 bmargin
  • 您必须手动地将你的钥匙
  • Before the second plot you must remove title, labels, tics and border, otherwise the graph might look jagged because of different anti-aliasing
  • To have the same margins you must also set fixed tmargin and bmargin
  • You must position your keys manually

以上code给你:

The above code gives you:

现在,你必须判断,如果它的价值。

Now you must judge if its worth.

这篇关于gnuplot的 - 不同长度的水平关键标题排列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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