LoginSignup
8
8

More than 5 years have passed since last update.

x軸を共有した複数のプロットを並べる

Posted at

gnuplotでx軸を共有した二つのプロットを縦に並べる方法。

  • multiplotを使う。layoutオプションを使う事でいくつのプロットを並べるか指定できる。
    • 縦に二つ並べる場合、layout 2,1と指定
  • 一つ目のプロット時に set bmargin 0 を指定し、二つ目のときに set tmargin 0 を指定する。これで二つのグラフが接する。
  • 一つ目のときはxtics, xlabelを非表示にする
  • また set lmargin 5 などのように適切なlmarginも指定する必要がある。(二つのグラフでlmarginを共有すること)
    • 指定しないと自動でマージンが決められるので、y軸の数字の桁数によってグラフの大きさが変わりx軸のスケールがずれる。

サンプル

set multiplot layout 2,1

set lmargin 5

set bmargin 0
unset xlabel
unset xtics
plot x

set tmargin 0
set bmargin 3
set xlabel "X"
set xtics
plot x*x

unset multiplot

出力例
multiplot_sample.png

8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8