1

I am trying to plot a time series on the left, and its histogram on the right. I have 10000 samples. The files ts.dat and hist.dat contains point to plot in the correct form. How can I plot the two axis aligned? With the code below, gnuplot aligns the canvas, and as the x labels are of different length the axis y length is different.

set term pngcairo font "Times New Roman, 8" size 640, 240
set out 'mp.png'
set multiplot
set tics out
set tics scale 0.5
unset key
set size .66, 1
set yrange[-6:6]
set xtics rotate by 45 right
set xlabel "Iteration no."
set ylabel "USD"
plot 'ts.dat' with lines
set origin .66, 0
set size .33, 1
set yrange [-6:6]
set format y ""
set style fill transparent solid 0.3
set xlabel "No. of occurences"
unset ylabel
plot 'hist.dat' using 2:1 with filledcurves
unset multiplot

enter image description here

3
  • What exactly do you want to be different in that image? The y axes look aligned to me, thanks to the matching set yrange [-6:6] calls. Commented Jan 26, 2020 at 16:27
  • the x axis on the right chart is below the x asis on the left chart since the y-axis on the right chart is slightly longer than the correspondant y-axis on the left. Commented Jan 26, 2020 at 16:35
  • Okay, I see it now. The mis-alignment is pretty small in the image and I simply missed it upon first glance. Commented Jan 26, 2020 at 17:00

1 Answer 1

2

Check help margins.

If you set a fixed bottom margin manually, e.g. set bmargin 3 or set bmargin at screen 0.1, the bottom x-axes should be aligned in both plots.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.