gnuplot水平键

gnuplot水平键,gnuplot,Gnuplot,我在multiplot环境中使用gnuplot。我只想有一个按键框(这不是问题),我想把它放在“水平模式”下的绘图 Nice Plot1 | Nice Plot2 Nice Plot3 | Nice Plot4 the keybox 似乎键盘框的总大小不能超过其相应绘图的宽度(因此这里是屏幕大小的一半)。这会导致键盘框中出现我不想要的行返回 有什么办法可以绕过它吗 谢谢 编辑:添加脚本。(钥匙盒在3行上) 这是一个丑陋的问题。我从来没有太多地使用过epslatex终端——正如文

我在multiplot环境中使用gnuplot。我只想有一个按键框(这不是问题),我想把它放在“水平模式”下的绘图

Nice Plot1 | Nice Plot2

Nice Plot3 | Nice Plot4

      the keybox
似乎键盘框的总大小不能超过其相应绘图的宽度(因此这里是屏幕大小的一半)。这会导致键盘框中出现我不想要的行返回

有什么办法可以绕过它吗

谢谢

编辑:添加脚本。(钥匙盒在3行上)


这是一个丑陋的问题。我从来没有太多地使用过epslatex终端——正如文档中所述,这可能会导致额外的复杂性

“使用Tex终端时…格式信息嵌入到字符串中,gnuplot只能估计字符串定位的正确宽度”

你说得对,gnuplot似乎不想制作一个比绘图更宽的键——可惜你不能像使用
矩形那样明确地指定宽度。不过,这很容易解决。诀窍是使绘图(不带关键点)与正常绘图一样,然后生成一个最终的“空”绘图,该绘图的大小与标签大小相同:

set term ...
set output ...

#Let the magic begin!

set multiplot
unset key

#<plot 1>
#...
#</plot 1>

#<plot 2>
#...
#</plot 2>

#<plot 3>
#...
#</plot 3>

#<plot 4>
#...
#</plot 4>

#<null>
#here we need to unset everything that was set previously
unset origin
unset border
unset tics
unset label
unset arrow
unset title
unset object

#Now set the size of this plot to something BIG
set size 2,2 #however big you need it

#example key settings
set key box 
set key horizontal reverse samplen 1 width -4 maxrows 1 maxcols 12 
set key at screen 0.5,screen 0.15 center top

#We need to set an explicit xrange.  Anything will work really.
set xrange [-1:1]
set yrange [-1:1]

plot NaN w title 'title 1',\
     NaN w title 'title 2',\
     NaN w title 'title 3',\
     NaN w title 'title 4'   #etc.

#</null>
unset multiplot  #<--- Necessary for some terminals, but not postscript I don't think.
设置术语。。。
设置输出。。。
#让魔法开始吧!
集多点
取消设置键
#
#...
#
#
#...
#
#
#...
#
#
#...
#
#
#在这里,我们需要取消设置之前设置的所有内容
未设置原点
未设置边界
不稳定抽搐
未设置标签
未设置箭头
未设置的标题
未设置对象
#现在将这个图的大小设置为较大的值
设置尺寸2,2#无论您需要多大
#示例键设置
设置钥匙盒
设置键水平反向采样1宽度-4最大行1最大列12
将按键设置在屏幕0.5、屏幕0.15中央顶部
#我们需要设置一个显式的xrange。任何事情都能奏效。
设置xrange[-1:1]
设置Y范围[-1:1]
地块名称为“标题1”\
NaN w标题“标题2”\
NaN w标题“标题3”\
NaN w标题“标题4”等。
#

unset multiplot#您能否发布一个最简单的示例脚本,或者用
plot x
或简单的东西替换所有的plot命令。我不太确定您得到的是哪种类型的行返回——当我尝试像
set key width 1000;plot x t''
键在离开屏幕边缘(大于绘图)时没有问题,而且我在很长的标题文本中没有换行符。我将它添加到了我的原始帖子中。对于给定的“非常长的字符串”,我没有换行符,但我有六条不同的“相当长的字符串”,它们位于3条不同的行上。谢谢你的回复。@victolunik——空情节技巧是一个非常肮脏的黑客,但它原来是我的一个go-to-gnuplot技巧。祝你好运(也祝你策划顺利!)。非常感谢@mgilson。我可以确认postscript终端不需要最后一个
unset multiplot
。我不得不做一个小小的调整:
plot-nanw-title“mytitle”
会产生一个错误:“MyScript.plt第XX行:无法识别的绘图类型”。我只是简单地将其更改为
plot Nan w lines title“mytitle”
,以使此错误消失。
set term ...
set output ...

#Let the magic begin!

set multiplot
unset key

#<plot 1>
#...
#</plot 1>

#<plot 2>
#...
#</plot 2>

#<plot 3>
#...
#</plot 3>

#<plot 4>
#...
#</plot 4>

#<null>
#here we need to unset everything that was set previously
unset origin
unset border
unset tics
unset label
unset arrow
unset title
unset object

#Now set the size of this plot to something BIG
set size 2,2 #however big you need it

#example key settings
set key box 
set key horizontal reverse samplen 1 width -4 maxrows 1 maxcols 12 
set key at screen 0.5,screen 0.15 center top

#We need to set an explicit xrange.  Anything will work really.
set xrange [-1:1]
set yrange [-1:1]

plot NaN w title 'title 1',\
     NaN w title 'title 2',\
     NaN w title 'title 3',\
     NaN w title 'title 4'   #etc.

#</null>
unset multiplot  #<--- Necessary for some terminals, but not postscript I don't think.