Search code examples
gnuplot

Joint graphs in gnuplot


I want to make a graph similar to the one in the image. How do I make such a combined graph with 3 graphs stacked up vertically?

enter image description here


Solution

  • A basic google search will provide you the answer. Since you haven't done that, here's a small example case

    f(x) = abs(x)<2*pi ? a*sin(x)           : 1/0
    g(x) = abs(x)<2*pi ? a*sin(x+pi/2)      : 1/0
    set multiplot layout 2,1 rowsfirst
    set label 1 'a' at graph 0.92,0.9 font ',8'
    plot f(x) with lines ls 1
    set label 1 'b' at graph 0.92,0.9 font ',8'
    plot g(x) with lines ls 1
    unset multiplot
    

    The desired output:

    enter image description here