gpt4 book ai didi

gnuplot 水平键

转载 作者:行者123 更新时间:2023-12-01 02:30:41 24 4
gpt4 key购买 nike

我在 multiplot 环境中使用 gnuplot。我只想有一个 key 箱(这不是问题),我想在图下放入“水平模式”。

Nice Plot1 | Nice Plot2

Nice Plot3 | Nice Plot4

the keybox

似乎keybox的总大小不能超过其对应绘图的宽度(所以这里是屏幕大小的一半)。这导致我不想要的 key 箱中的线路返回。

有没有办法绕过它?

谢谢。

编辑:添加了脚本。 ( key 箱在 3 行上)
set terminal epslatex color
set output 'Plot.tex'
set multiplot
set xrange [0:0.8]
set key box
set key reverse horizontal maxcols 10 samplen 0.5 spacing 1
#set key font ",9"
set key at screen 0.9,0.15
set size 0.5,0.5
set origin 0,0
set lmargin 4
set bmargin 3
set rmargin 0
set tmargin 0
set xtics nomirror
set ytics nomirror
plot x with lines lt 1 lw 4 lc rgb "red" title 'Median',\
x with lines lw 4 lc rgb "blue" title '$ F,F^{-1}$',\
x with lines lw 4 lc rgb "magenta" title '$ F,\Gamma^\mathcal{P}$',\
x with lines lw 4 lc rgb "orange" title '$\Lambda_\text{MI}$',\
x with lines lt 1 lw 4 lc rgb "green" title '$k$-NN'


#
# Plot n°2
#
set size 0.5,0.5
set origin 0,0.5
set xrange [0:0.8]
set key off
set title ''
set lmargin 4
set bmargin 3
set rmargin 0
set tmargin 0
set xtics nomirror
set ytics nomirror
plot x with lines lt 1 lw 4 lc rgb "red" title 'Median',\
x with lines lw 4 lc rgb "blue" title '$ F,F^{-1}$',\
x with lines lw 4 lc rgb "magenta" title '$ F,\Gamma^\mathcal{P}$',\
x with lines lw 4 lc rgb "orange" title '$\Lambda_\text{MI}$',\
x with lines lt 1 lw 4 lc rgb "green" title 'KNN',\
x with lines lt 1 lw 4 lc rgb "black" title 'Ground Truth'

set size 0.5,0.5
set origin 0.5,0
set xrange [0:0.8]
set key off
set title ''
set lmargin 4
set bmargin 3
set rmargin 0
set tmargin 0
set xtics nomirror
set ytics nomirror
plot x with lines lt 1 lw 4 lc rgb "red" title 'Median',\
x with lines lw 4 lc rgb "blue" title '$ F,F^{-1}$',\
x with lines lw 4 lc rgb "magenta" title '$ F,\Gamma^\mathcal{P}$',\
x with lines lw 4 lc rgb "orange" title '$\Lambda_\text{MI}$',\
x with lines lt 1 lw 4 lc rgb "green" title 'KNN',\
x with lines lt 1 lw 4 lc rgb "black" title 'Ground Truth'


set size 0.5,0.5
set origin 0.5,0.5
set xrange [0:0.8]
set key off
set title ''
set lmargin 4
set bmargin 3
set rmargin 0
set tmargin 0
set xtics nomirror
set ytics nomirror
plot x with lines lt 1 lw 4 lc rgb "red" title 'Median',\
x with lines lw 4 lc rgb "blue" title '$ F,F^{-1}$',\
x with lines lw 4 lc rgb "magenta" title '$ F,\Gamma^\mathcal{P}$',\
x with lines lw 4 lc rgb "orange" title '$\Lambda_\text{MI}$',\
x with lines lt 1 lw 4 lc rgb "green" title 'KNN',\
x with lines lt 1 lw 4 lc rgb "black" title 'Ground Truth'

最佳答案

这是一个丑陋的问题。我从来没有真正使用过 epslatex 终端——这可能会导致额外的复杂性,因为文档指出

"When using the Tex terminal ... where formatting information is embedded in the string, gnuplot can only estimate the correct width for string positioning"



你是对的,gnuplot 似乎不想制作一个比图更宽的键——太糟糕了,你不能像使用 rectangle 那样明确指定宽度。 .不过,这很容易解决。诀窍是使您的图(没有键)正常,然后制作一个与标签一样大的最终“空”图:
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.

关于gnuplot 水平键,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13181224/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com