2
votes

I am trying to plot five graphs (a,b,c,d,e) in a column order as shown below.

The x-scale for each plot is different and they are not in a vertical line but graphs (c), (d) and (e) have almost similar x range values, that is 24.8.

When I plot these graphs in column order, I find graph labeled (a) and (b) are stretch and compressed respectively. However, graphs labeled (c), (d) and (e) are having a same scale length.

I have drawn a red line vertically to show how the x-scale of each graph is aligned. (Please see the attached figure)

enter image description here

The gnuplot script that I used is given below.

#!/usr/bin/env gnuplot


#########################################################################################
#OUTPUT

#PNG
set terminal pngcairo size 600,550 enhanced dash #font "Arial-Bold,13" #fontscale 1.20
set output "zMulti-plot-LDP-lyoSystems.png"

#########################################################################################

set style line 1 lt 1 lw 1.5  lc rgb "red"
set style line 2 lt 3 lw 1.5  lc rgb "red"
set style line 3 lt 5 lw 1.5  lc rgb "red"

set style line 4 lt 1 lw 1.5  lc rgb "black"
set style line 5 lt 3 lw 1.5  lc rgb "black"
set style line 6 lt 5 lw 1.5  lc rgb "black"

set style line 7 lt 1 lw 1.5  lc rgb "green"
set style line 8 lt 3 lw 1.5  lc rgb "green"
set style line 9 lt 5 lw 1.5  lc rgb "green"

set style line 10 lt 1 lw 1.5  lc rgb "blue"
set style line 11 lt 3 lw 1.5  lc rgb "blue"
set style line 12 lt 5 lw 1.5  lc rgb "blue"

set style line 13 lt 1 lw 1.5  lc rgb "magenta"
set style line 14 lt 3 lw 1.5  lc rgb "magenta"
set style line 15 lt 5 lw 1.5  lc rgb "magenta"

set style line 16 lt 1 lw 1.5  lc rgb "#6495ED"
set style line 17 lt 3 lw 1.5  lc rgb "#6495ED"
set style line 18 lt 5 lw 1.5  lc rgb "#6495ED"

#########################################################################################
set macro
#ylabelFONT="font 'arial,16'"
labelFONT="font 'Arial,18'"
scaleFONT="font 'Arial-Bold,14'"
keyFONT="font 'Arial,10'"
#graph="using 1:2 with lines lw 1 "

#########################################################################################

xsize = 0.80
ysize = 0.22
xorigin = 0.002
yorigin = 0.02

#####################################################################
set xrange [-24.8:24.8]
set yrange [0:2.5]
set xtic auto       @scaleFONT    # set xtics automatically
#set ytic 0,0.2,0.4     @scaleFONT    # set ytics automatically
set ytic " " #0,0.2,0.4     @scaleFONT    # set ytics automatically
unset key

set size 1.0,1.0
set multiplot



# plot A
set ylabel ""
set label "(e)" at 0,0.60   @scaleFONT
set origin xorigin,yorigin
set size xsize,(ysize+0.015)

plot    "bcm25perRS-000-050ns_only_HEAD.dat"       using 1:2 title  '1-050ns'  w  l  ls  1  ,\
        "bcm25perRS-000-050ns_only_TAIL.dat"       using 1:2 title  '1-050ns'  w  l  ls  2  ,\
        "bcm25perRS-000-050ns_only_WATER.dat"      using 1:2 title  '1-050ns'  w  l  ls  3  ,\
        "bcm25perRS-051-100ns_only_HEAD.dat"       using 1:2 title  '51-100ns'  w  l  ls  4  ,\
        "bcm25perRS-051-100ns_only_TAIL.dat"       using 1:2 title  '51-100ns'  w  l  ls  5  ,\
        "bcm25perRS-051-100ns_only_WATER.dat"      using 1:2 title  '51-100ns'  w  l  ls  6  ,\
        "bcm25perRS-101-150ns_only_HEAD.dat"       using 1:2 title  '101-150ns'  w  l  ls  7  ,\
        "bcm25perRS-101-150ns_only_TAIL.dat"       using 1:2 title  '101-150ns'  w  l  ls  8  ,\
        "bcm25perRS-101-150ns_only_WATER.dat"      using 1:2 title  '101-150ns'  w  l  ls  9  ,\
        "bcm25perRS-151-200ns_only_HEAD.dat"       using 1:2 title  '151-200ns'  w  l  ls  10 ,\
        "bcm25perRS-151-200ns_only_TAIL.dat"       using 1:2 title  '151-200ns'  w  l  ls  11 ,\
        "bcm25perRS-151-200ns_only_WATER.dat"      using 1:2 title  '151-200ns'  w  l  ls  12 ,\
        "bcm25perRS-201-250ns_only_HEAD.dat"       using 1:2 title  '201-250ns'  w  l  ls  13 ,\
        "bcm25perRS-201-250ns_only_TAIL.dat"       using 1:2 title  '201-250ns'  w  l  ls  14 ,\
        "bcm25perRS-201-250ns_only_WATER.dat"      using 1:2 title  '201-250ns'  w  l  ls  15 ,\
        "bcm25perRS-251-300ns_only_HEAD.dat"       using 1:2 title  '251-300ns'  w  l  ls  16 ,\
        "bcm25perRS-251-300ns_only_TAIL.dat"       using 1:2 title  '251-300ns'  w  l  ls  17 ,\
        "bcm25perRS-251-300ns_only_WATER.dat"      using 1:2 title  '251-300ns'  w  l  ls  18




# plot B
set xrange [-24.8:24.8]
set ylabel ""
unset label
set label "(d)" at 0,0.60   @scaleFONT
#set format x ""
set origin xorigin,(yorigin+0.19)
set size xsize,ysize+0.02

plot    "bcm25perS-000-050ns_only_HEAD.dat"       using 1:2 title  '1-050ns'  w  l  ls  1  ,\
        "bcm25perS-000-050ns_only_TAIL.dat"       using 1:2 title  '1-050ns'  w  l  ls  2  ,\
        "bcm25perS-000-050ns_only_WATER.dat"      using 1:2 title  '1-050ns'  w  l  ls  3  ,\
        "bcm25perS-051-100ns_only_HEAD.dat"       using 1:2 title  '51-100ns'  w  l  ls  4  ,\
        "bcm25perS-051-100ns_only_TAIL.dat"       using 1:2 title  '51-100ns'  w  l  ls  5  ,\
        "bcm25perS-051-100ns_only_WATER.dat"      using 1:2 title  '51-100ns'  w  l  ls  6  ,\
        "bcm25perS-101-150ns_only_HEAD.dat"       using 1:2 title  '101-150ns'  w  l  ls  7  ,\
        "bcm25perS-101-150ns_only_TAIL.dat"       using 1:2 title  '101-150ns'  w  l  ls  8  ,\
        "bcm25perS-101-150ns_only_WATER.dat"      using 1:2 title  '101-150ns'  w  l  ls  9  ,\
        "bcm25perS-151-200ns_only_HEAD.dat"       using 1:2 title  '151-200ns'  w  l  ls  10 ,\
        "bcm25perS-151-200ns_only_TAIL.dat"       using 1:2 title  '151-200ns'  w  l  ls  11 ,\
        "bcm25perS-151-200ns_only_WATER.dat"      using 1:2 title  '151-200ns'  w  l  ls  12 ,\
        "bcm25perS-201-250ns_only_HEAD.dat"       using 1:2 title  '201-250ns'  w  l  ls  13 ,\
        "bcm25perS-201-250ns_only_TAIL.dat"       using 1:2 title  '201-250ns'  w  l  ls  14 ,\
        "bcm25perS-201-250ns_only_WATER.dat"      using 1:2 title  '201-250ns'  w  l  ls  15 ,\
        "bcm25perS-251-300ns_only_HEAD.dat"       using 1:2 title  '251-300ns'  w  l  ls  16 ,\
        "bcm25perS-251-300ns_only_TAIL.dat"       using 1:2 title  '251-300ns'  w  l  ls  17 ,\
        "bcm25perS-251-300ns_only_WATER.dat"      using 1:2 title  '251-300ns'  w  l  ls  18


# plot C
set xrange [-24.4:24.4]
set ylabel ""
unset label
set label "(c)" at 0,0.60   @scaleFONT
set origin xorigin,(yorigin+0.385)
set size xsize,ysize+0.02
plot    "bcm25perR-000-050ns_only_HEAD.dat"       using 1:2 title  '1-050ns'  w  l  ls  1  ,\
        "bcm25perR-000-050ns_only_TAIL.dat"       using 1:2 title  '1-050ns'  w  l  ls  2  ,\
        "bcm25perR-000-050ns_only_WATER.dat"      using 1:2 title  '1-050ns'  w  l  ls  3  ,\
        "bcm25perR-051-100ns_only_HEAD.dat"       using 1:2 title  '51-100ns'  w  l  ls  4  ,\
        "bcm25perR-051-100ns_only_TAIL.dat"       using 1:2 title  '51-100ns'  w  l  ls  5  ,\
        "bcm25perR-051-100ns_only_WATER.dat"      using 1:2 title  '51-100ns'  w  l  ls  6  ,\
        "bcm25perR-101-150ns_only_HEAD.dat"       using 1:2 title  '101-150ns'  w  l  ls  7  ,\
        "bcm25perR-101-150ns_only_TAIL.dat"       using 1:2 title  '101-150ns'  w  l  ls  8  ,\
        "bcm25perR-101-150ns_only_WATER.dat"      using 1:2 title  '101-150ns'  w  l  ls  9  ,\
        "bcm25perR-151-200ns_only_HEAD.dat"       using 1:2 title  '151-200ns'  w  l  ls  10 ,\
        "bcm25perR-151-200ns_only_TAIL.dat"       using 1:2 title  '151-200ns'  w  l  ls  11 ,\
        "bcm25perR-151-200ns_only_WATER.dat"      using 1:2 title  '151-200ns'  w  l  ls  12 ,\
        "bcm25perR-201-250ns_only_HEAD.dat"       using 1:2 title  '201-250ns'  w  l  ls  13 ,\
        "bcm25perR-201-250ns_only_TAIL.dat"       using 1:2 title  '201-250ns'  w  l  ls  14 ,\
        "bcm25perR-201-250ns_only_WATER.dat"      using 1:2 title  '201-250ns'  w  l  ls  15 ,\
        "bcm25perR-251-300ns_only_HEAD.dat"       using 1:2 title  '251-300ns'  w  l  ls  16 ,\
        "bcm25perR-251-300ns_only_TAIL.dat"       using 1:2 title  '251-300ns'  w  l  ls  17 ,\
        "bcm25perR-251-300ns_only_WATER.dat"      using 1:2 title  '251-300ns'  w  l  ls  18

# plot D
set xrange [-26.2:26.2]
set xtics auto
set ylabel ""
unset label
set label "(b)" at 0,0.60   @scaleFONT
set origin xorigin,(yorigin+0.58)
set size xsize,ysize+0.02



plot    "malto23per-000-050ns_only_HEAD.dat"       using 1:2 title  '1-050ns'  w  l  ls  1  ,\
        "malto23per-000-050ns_only_TAIL.dat"       using 1:2 title  '1-050ns'  w  l  ls  2  ,\
        "malto23per-000-050ns_only_WATER.dat"      using 1:2 title  '1-050ns'  w  l  ls  3  ,\
        "malto23per-051-100ns_only_HEAD.dat"       using 1:2 title  '51-100ns'  w  l  ls  4  ,\
        "malto23per-051-100ns_only_TAIL.dat"       using 1:2 title  '51-100ns'  w  l  ls  5  ,\
        "malto23per-051-100ns_only_WATER.dat"      using 1:2 title  '51-100ns'  w  l  ls  6  ,\
        "malto23per-101-150ns_only_HEAD.dat"       using 1:2 title  '101-150ns'  w  l  ls  7  ,\
        "malto23per-101-150ns_only_TAIL.dat"       using 1:2 title  '101-150ns'  w  l  ls  8  ,\
        "malto23per-101-150ns_only_WATER.dat"      using 1:2 title  '101-150ns'  w  l  ls  9  ,\
        "malto23per-151-200ns_only_HEAD.dat"       using 1:2 title  '151-200ns'  w  l  ls  10 ,\
        "malto23per-151-200ns_only_TAIL.dat"       using 1:2 title  '151-200ns'  w  l  ls  11 ,\
        "malto23per-151-200ns_only_WATER.dat"      using 1:2 title  '151-200ns'  w  l  ls  12 ,\
        "malto23per-201-250ns_only_HEAD.dat"       using 1:2 title  '201-250ns'  w  l  ls  13 ,\
        "malto23per-201-250ns_only_TAIL.dat"       using 1:2 title  '201-250ns'  w  l  ls  14 ,\
        "malto23per-201-250ns_only_WATER.dat"      using 1:2 title  '201-250ns'  w  l  ls  15 ,\
        "malto23per-251-300ns_only_HEAD.dat"       using 1:2 title  '251-300ns'  w  l  ls  16 ,\
        "malto23per-251-300ns_only_TAIL.dat"       using 1:2 title  '251-300ns'  w  l  ls  17 ,\
        "malto23per-251-300ns_only_WATER.dat"      using 1:2 title  '251-300ns'  w  l  ls  18



# plot E
set xrange [-20.0:20.0]
set xtics auto
set ylabel ""
unset label
set label "(a)" at 0,0.60   @scaleFONT
set origin xorigin,(yorigin+0.77)
set size xsize,ysize+0.02


plot    "malto12per-000-050ns_only_HEAD.dat"       using 1:2 title  '1-050ns'  w  l  ls  1  ,\
        "malto12per-000-050ns_only_TAIL.dat"       using 1:2 title  '1-050ns'  w  l  ls  2  ,\
    "malto12per-000-050ns_only_WATER.dat"      using 1:2 title  '1-050ns'  w  l  ls  3  ,\
    "malto12per-051-100ns_only_HEAD.dat"       using 1:2 title  '51-100ns'  w  l  ls  4  ,\
    "malto12per-051-100ns_only_TAIL.dat"       using 1:2 title  '51-100ns'  w  l  ls  5  ,\
    "malto12per-051-100ns_only_WATER.dat"      using 1:2 title  '51-100ns'  w  l  ls  6  ,\
    "malto12per-101-150ns_only_HEAD.dat"       using 1:2 title  '101-150ns'  w  l  ls  7  ,\
    "malto12per-101-150ns_only_TAIL.dat"       using 1:2 title  '101-150ns'  w  l  ls  8  ,\
    "malto12per-101-150ns_only_WATER.dat"      using 1:2 title  '101-150ns'  w  l  ls  9  ,\
    "malto12per-151-200ns_only_HEAD.dat"       using 1:2 title  '151-200ns'  w  l  ls  10 ,\
    "malto12per-151-200ns_only_TAIL.dat"       using 1:2 title  '151-200ns'  w  l  ls  11 ,\
    "malto12per-151-200ns_only_WATER.dat"      using 1:2 title  '151-200ns'  w  l  ls  12 ,\
    "malto12per-201-250ns_only_HEAD.dat"       using 1:2 title  '201-250ns'  w  l  ls  13 ,\
    "malto12per-201-250ns_only_TAIL.dat"       using 1:2 title  '201-250ns'  w  l  ls  14 ,\
    "malto12per-201-250ns_only_WATER.dat"      using 1:2 title  '201-250ns'  w  l  ls  15 ,\
    "malto12per-251-300ns_only_HEAD.dat"       using 1:2 title  '251-300ns'  w  l  ls  16 ,\
    "malto12per-251-300ns_only_TAIL.dat"       using 1:2 title  '251-300ns'  w  l  ls  17 ,\
    "malto12per-251-300ns_only_WATER.dat"      using 1:2 title  '251-300ns'  w  l  ls  18   



# plot F
set size 0.3,0.5
set origin 0.76,0.55
set bmargin at screen 0
set key center center
set border 0 
unset xlabel
unset ylabel
unset label
unset tics
set format x ""
set format y ""

set yrange [0:1]
plot 2 ls 1 t '1-50ns', \
     2 ls 4 t '51-100ns', \
     2 ls 7 t '101-150ns', \
     2 ls 10    t '151-200ns', \
     2 ls 13    t '201-250ns', \
     2 ls 16    t '251-300ns'

unset multiplot

Can someone have a look into this issue and help me to get a multiplot as I shown but let the scale of each plot is align in vertical order?

It is OK if the graph size is small or big.

But I want the scale to be in line vertically.

Appreciate all your help.

Thank you.

If I edit the set xrange [-26.2:26.2] to be same for all, than I get something below.. which I dont want. I only want as how I shown in the first picture.

enter image description here

1
Just glancing over it I see that you are setting the xranges differently for each subgraph. Just sticking to one (probably the largest, [-26.2:26.2] )should solve your problem, if I understand it correctly. Without data no way to check.vaettchen
Dear #vaettchen, I have reedited my post with making the xrange to be same to all plots. I get a graph as shown. I don't want any "down shoulder" both the side of all the plots.Vijay

1 Answers

1
votes

Basically you must adjust x-values of the plot size and origin such, that the widest plots keep their current size, and all others are shifted and squeezed according to their smaller ranges.

Since I don't have any data files and cannot test the whole script anyway, here is a sketch of what you need to do:

xsize(width) = 0.80 * width / width_max
ysize = 0.22
width_max = (2 * 26.2)
left_min = -26.2
xorigin(left) = 0.002 + (left - left_min) * xsize / width_max 
yorigin = 0.02


set multiplot

# plot A
set xrange [-24.8:24.8]
set origin xorigin(-24.8),yorigin
set size xsize(2*24.8),(ysize+0.015)

plot ...

# plot B
set xrange [-24.8:24.8]
set origin xorigin(-24.8),(yorigin+0.19)
set size xsize(2*24.8),ysize+0.02

plot ...

# plot C
set xrange [-24.4:24.4]
set origin xorigin(-24.4),(yorigin+0.385)
set size xsize(2*24.4),ysize+0.02

plot ...

# plot D
set xrange [-26.2:26.2]
set origin xorigin(-26.2),(yorigin+0.58)
set size xsize(2*26.2),ysize+0.02

plot ...

# plot E
set xrange [-20.0:20.0]
set origin xorigin(-20),(yorigin+0.77)
set size xsize(2*20),ysize+0.02

plot ...