Search code examples
gnuplot

Output y-axes flattened


I'm trying to reproduce this (first answer with the 12 boxes), but my output is smashed, flattened, e.g., the y-axes are all flattened. Here's what I have in a text file then running gnuplot at the command line

### 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

What can I do to get 1:1 ratio?


Solution

  • set size ratio 1.0 will force the plots to be square. However they will be very small squares unless you do something to prevent the title and top/bottom margins from occupying most of the space.

    To see how this works, try

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

    Then you can decide how to adjust the title position or how else to label the individual plots so that it does not require extra vertical space. You could also look into using the margins keyword of the set multiplot layout command.