首页 > 解决方案 > 输出 y 轴变平

问题描述

我试图重现这一点(第一个答案是 12 个盒子),但我的输出被粉碎、变平,例如,y 轴都变平了。这是我在文本文件中的内容,然后在命令行运行 gnuplot

### curves with different ranges & samples within one plot command
reset session
set colorsequence classic
set terminal svg enhanced
set output "para1.svg"
###set size 600, 1400

Random      = "[0:1:0.001]    '+' u (2*rand(0)):(2*rand(0)) w p pt 7 ps 0.5 not"
RandomFirst = "[0:1]          '+' u (2*rand(0)):(2*rand(0)) w p pt 7 ps 0.5 not"
Circle      = "[0:2*pi:pi/12] '+' u (cos($1)):(sin($1)) w lp pt 7 not"
CircleFirst = "[0:2*pi]       '+' u (cos($1)):(sin($1)) w lp pt 7 not"
Line        = "[-0.5:0.5:0.5] '+' u 1:1 w lp pt 7 lw 2 not"
LineFirst   = "[-0.5:0.5]     '+' u 1:1 w lp pt 7 lw 2 not"

set multiplot layout 4,3 columnsfirst

    set label 1 "random/circle/line" at screen 0.166,0.99 center
    unset parametric
        set title "parametric OFF"
        plot @RandomFirst, @Circle, @Line
    set parametric
        set title "parametric ON"
        plot @Random, @Circle, @Line
    unset parametric
    set samples 1000
        set title "parametric OFF"
        plot @RandomFirst, @Circle, @Line
    set parametric
        set title "parametric ON"
        plot @Random, @Circle, @Line

    set label 2 "line/random/circle" at screen 0.5,0.99 center
    unset parametric
        set title "parametric OFF"
        plot @LineFirst, @Random, @Circle
    set parametric
        set title "parametric ON"
        plot @Line, @Random, @Circle
    set samples 3
    unset parametric
        set title "parametric OFF"
        plot @LineFirst, @Random, @Circle
    set parametric
        set title "parametric ON"
        plot @Line, @Random, @Circle


    set label 3 "circle/line/random" at screen 0.833,0.99 center
    unset parametric
        set title "parametric OFF"
        plot @CircleFirst, @Line, @Random, 
    set parametric
        set title "parametric ON"
        plot @Circle, @Line, @Random, 
    set samples 24
    unset parametric
        set title "parametric OFF"
        plot @CircleFirst, @Line, @Random, 
    set parametric
        set title "parametric ON"
        plot @Circle, @Line, @Random, 

    unset multiplot
### end of code

我该怎么做才能获得 1:1 的比例?

标签: gnuplot

解决方案


set size ratio 1.0将强制地块是正方形的。但是,除非您采取措施防止标题和顶部/底部边距占据大部分空间,否则它们将是非常小的正方形。

要了解这是如何工作的,请尝试

set tmargin 0
set bmargin 0
set title offset 0,-1
###
... rest of commands as before ...
###

然后,您可以决定如何调整标题位置或如何标记各个图,使其不需要额外的垂直空间。您还可以考虑使用命令的margins关键字set multiplot layout


推荐阅读