You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

gnuplot复现多子图参数化绘图y轴被压扁如何获取1:1等比例输出

你需要修改三处配置即可实现1:1等比例输出:

  • 给svg终端指定适配4行3列布局的画布尺寸,避免默认宽高比例失调
  • 添加set size ratio -1配置,强制每个子图的x、y轴单位物理长度等比例,不会被拉伸变形
  • 可选:给multiplot配置边距和间距,避免子图标题、顶部标签被裁剪

修改后的完整脚本如下:

### curves with different ranges & samples within one plot command
reset session
set colorsequence classic
# 指定svg画布尺寸,3列4行布局对应宽高比约3:4
set terminal svg enhanced size 900, 1200
set output "para1.svg"
# 强制轴比例1:1
set size ratio -1

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"

# 配置multiplot边距和间距
set multiplot layout 4,3 columnsfirst margins 0.08, 0.95, 0.05, 0.92 spacing 0.12

    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

注:原脚本里每个plot末尾多余的逗号也一并移除了,避免运行告警。

内容的提问来源于stack exchange,提问作者147pm

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.01 12:15:05