title: Adjusting the scale of every plot in multiplot to be evenly spaced
body: <p>I am trying to plot multiple graphs using "multiplot" option from gnuplot.
  The figure I plot was as below.</p>
  
  <p>I have a small problem but I dont know how to solve this. The problem is regarding the scale of every individual plot. If one notice, scale for every plot a, b, c, d and e is different. For every plot I used different <code>set xrange</code> values. So, I understand gnuplot tried to stretched the plots to fit into the given width limit. Due to that, the scale along horizontal axis do not evenly spaced.</p>
  
  <p>I want the scale to be evenly spaced for every plot especially for horizontal axis.</p>
  
  <p>Below I have given the full code for your view.  </p>
  
  <p>How I can get this done?</p>
  
  <p>Many thanks in advance.</p>
  
  <p><img src="https://i.stack.imgur.com/tLpWF.png" alt="enter image description here"></p>
  
  <pre><code>#!/usr/bin/gnuplot
  
  ########################################################################################
  
  mpl_top    = 0.4 #inch  outer top margin, title goes here
  mpl_bot    = 0.7 #inch  outer bottom margin, x label goes here
  mpl_left   = 0.3 #inch  outer left margin, y label goes here    #vj
  mpl_right  = 0.8 #inch  outer right margin, y2 label goes here  #vj
  mpl_height = 1.0 #inch  height of individual plots
  mpl_width  = 2.2 #inch  width of individual plots       #vj  
  mpl_dx     = 0.1 #inch  inter-plot horizontal spacing
  mpl_dy     = 0.4 #inch  inter-plot vertical spacing
  mpl_ny     = 5   #number of rows
  mpl_nx     = 1   #number of columns
  
  # calculate full dimensions
  xsize = mpl_left+mpl_right+(mpl_width*mpl_nx)+(mpl_nx-1)*mpl_dx
  ysize = mpl_top+mpl_bot+(mpl_ny*mpl_height)+(mpl_ny-1)*mpl_dy
  
  # placement functions
  #   rows are numbered from bottom to top
  bot(n) = (mpl_bot+(n-1)*mpl_height+(n-1)*mpl_dy)/ysize
  top(n)  = 1-((mpl_top+(mpl_ny-n)*(mpl_height+mpl_dy))/ysize)
  #   columns are numbered from left to right
  left(n) = (mpl_left+(n-1)*mpl_width+(n-1)*mpl_dx)/xsize
  right(n)  = 1-((mpl_right+(mpl_nx-n)*(mpl_width+mpl_dx))/xsize)
  
  #=================================================================
  
  #set terminal postscript eps enhanced color dl 2.0 size xsize,ysize "Helvetica" 28
  ##set encoding iso_8859_1
  ##set tics scale 1
  #set output 'nxm_plot.eps'
  
  
  set terminal pngcairo size 650,650 enhanced dash #font "Arial-Bold,13" #fontscale 1.20
  set output "Fill-Multi-plot-LDP-lyoSystemLast50ns.png"
  
  set encoding iso_8859_1
  
  set offsets
  set autoscale fix
  set size 1,1
  set nokey
  
  # define x-axis settings for all subplots
  #set xrange [-30:30]
  set yrange [0:3]
  set xlabel ''
  #set format x ''
  set xtic auto
  #set xtics 5    #pi
  #set mxtics 4
  
  
  #### VJ DEFINITION
  #set style line 4 lt 4 lw 10    # Please DISABLE pause -1 
  #########################################################################################
  
  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,16'"
  scaleFONT="font 'Arial-Bold,14'"
  scaleFONtt="font 'Helvetica,10'"
  keyFONT="font 'Arial,12'"
  #graph="using 1:2 with lines lw 1 "
  
  ###################################################################################################
  
  
  # start plotting
  set multiplot
  
  #-----------------------------------------------
  # subplot  1-5
  #  set horizontal margins for first column
  set lmargin at screen left(1)
  set rmargin at screen right(1)
  #  set horizontal margins for third row (top)
  set tmargin at screen top(5)
  set bmargin at screen bot(5)
  
  
  set label "(a)" at -1.5,2.5  @labelFONT
  set title ''
  unset ylabel
  set xrange [-20.0:20.0]
  set format y "" #"%-2.1f"
  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 
  ;
  
  
  #-----------------------------------------------
  # subplot  1-4 at top most
  #  set horizontal margins for first column
  set lmargin at screen left(1)
  set rmargin at screen right(1)
  #  set horizontal margins for third row (top)
  set tmargin at screen top(4)
  set bmargin at screen bot(4)
  
  
  unset label
  set label "(b)" at -1.5,2.5  @labelFONT
  set title ''
  unset ylabel
  set xtics
  set xrange [-26.2:26.2]
  set format y "" #"%-2.1f"
  
  
  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
  ;
  
  
  #-----------------------------------------------
  # subplot  1-3
  #  set horizontal margins for first column
  set lmargin at screen left(1)
  set rmargin at screen right(1)
  #  set horizontal margins for second row (middle)
  set tmargin at screen top(3)
  set bmargin at screen bot(3)
  
  
  unset label
  set label "(c)" at -1.5,2.5  @labelFONT
  set title ''
  set ylabel "Number Density" @labelFONT
  set xrange [-24.2:24.2]
  set format y "" #"%-1.1f"
  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
  ;
  
  
  
  #-----------------------------------------------
  # subplot  1-2
  #  set horizontal margins for first column
  set lmargin at screen left(1)
  set rmargin at screen right(1)
  #  set horizontal margins for second row (middle)
  set tmargin at screen top(2)
  set bmargin at screen bot(2)
  
  
  unset label
  set label "(d)" at -1.5,2.5  @labelFONT
  set title ''
  unset ylabel
  set xrange [-24.8:24.8]
  set format y "" #"%-1.1f"
  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
  ;
  
  
  #-----------------------------------------------
  # subplot  1-1
  #  set horizontal margins for first column
  set lmargin at screen left(1)
  set rmargin at screen right(1)
  #  set horizontal margins for first row (bottom)
  set tmargin at screen top(1)
  set bmargin at screen bot(1)
  
  
  unset label
  set label "(e)" at -1.5,2.5  @labelFONT
  set title ''
  # now set a label and tic marks for the x-axis
  set xlabel "Distance / ({\305})"    @labelFONT
  unset ylabel
  set xrange [-24.1:24.1]
  set format y "" # "%-1.1f"
  
  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
  ;
  
  #----------------------------------------------------
  set size 0.3,0.5
  set origin -0.56,-0.35
  set bmargin at screen 0
  #set key at screen 0.85,screen 0.45 Left reverse spacing 1.0 samplen 1.0 maxcols 1 maxrows 6 @keyFONT
  set key at screen 1.00,screen 0.45 maxcols 3 maxrows 6 @keyFONT
  #set key center left  
  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
  </code></pre>