CGiant1807
CGiant1807

Reputation: 21

Gnuplot Multiplot Individual Plot Sizes + Labels

I am currently trying to produce a decent multiplot in Gnuplot. Sadly I ran into some problems.

As the y-axis for both figures is the same I want to only label and tic it once, however I cant remove those from only the left plot.

Secondly I want to increase the width of the left plot while decreasing the one of the right.

Here is a picture of what I got so far, the code is below.

Plot so far

set term postscript eps enhanced color "Helvetica" 10
set output "dosband.eps"
set title "Bandstructure and Density of States"
#
set multiplot layout 1,2 \
              margins 0.075,0.98,0.1,0.98 \
              spacing 0.02,0.08 #margins: left,right,bottom,top; spacing: vertical, horizontal
set title "Bandstructure"
plot 'plotband.dat' using 1:2 with lines lt 1 lw 0.5 linecolor rgb "black" notitle
set xlabel "Density [states/eV]" #dont ask me why I have to swap the xlabels around
set ylabel "Energy [eV]"
#
set title "Density of States"
plot 'plotdos.dat' using 1:2 with lines lt 1 linecolor rgb "black" notitle 
set xlabel "K-Points"
unset multiplot

Thanks in advance for any answers!

Upvotes: 2

Views: 4961

Answers (1)

ewcz
ewcz

Reputation: 13087

As noted by @Christoph, using explicit margins is one of the solutions. In your particular case, you could proceed as:

#dimensions are in screen units
width_left = 0.48
width_right = 0.25
eps_v = 0.12
eps_h_left = 0.1
eps_h_right = 0.05

unset key

set multiplot

set tmargin at screen 1. - eps_v
set bmargin at screen eps_v

set lmargin at screen 0.1
set rmargin at screen eps_h_left + width_left

set xr [0:1.4]
set xtics 0,0.2,1.4
set yr [-40:5]
unset ytics
set y2r [-40:5]
set y2tics in mirror
set format y2 "" #draw ticks but no tic labels

set title "Plot 1"
set xlabel "title 1"
plot 1/0

set lmargin at screen 1. - (width_right + eps_h_right)
set rmargin at screen 1. - eps_h_right

set xr [0:100]
set xtics 0,25,100
unset y2tics
set yr [-40:5]
set ytics in mirror
set mytics 1

set title "Plot 2"
set xlabel "title 2"
set ylabel "Energy [eV]"
plot 1/0

This produces: enter image description here

In case the Energy [eV] label is supposed to be moved completely to the left, one can adjust the spacings/tics accordingly...

Upvotes: 2

Related Questions