Bus errorとSegmentation faultに困ったら見るブログ

物理の研究者による日々の研究生活のメモ書きです ( python/emacs/html/Japascript/シェルスクリプト/TeX/Mac/C言語/Linux/git/tmux/R/ポケモンGO)

【gnuplot】積分範囲を塗りつぶしたグラフを描きたい

2週間ほど前に思い立って、「よくつかう確率分布の有為度早見表」を作ってみました
とりあえずガウス、ポアソン、レイリー分布をピックアップ

追加するとしたらカイ2乗分布とか?


そのときに積分範囲を塗りつぶしたグラフを書く必要が出てきたので
どういうことをしたのかメモしておきます

f(x)=1.0/sqrt(2*pi)*exp(-x*x/2.0)
sigma = 1.5set lmargin 5
set rmargin 4
set tmargin 2
set bmargin 2
set size ratio 2.0/7.0
set term pdf size 7, 2
set output "gauss_twoside.pdf"
set multiplot layout 1,2
plot [-4:4][0:0.45] (-sigma < x && x < sigma ? f(x) : 1/0) with filledcurve x1 lc 3 notitle , f(x) w l lw 3 lc -1 notitle
plot [-4:4][0:0.45] (x < -sigma ? f(x) : 1/0) with filledcurve x1 lc 3 notitle , f(x) w l lw 3 lc -1 notitle, (sigma < x ? f(x) : 1/0) with filledcurve x1 lc 3 notitle
unset multiplot
これでこんな感じのグラフが書けます

横長出力、2つのグラフを重ねるあたりは過去記事を参考にしたらなんとかできました

ランキング参加中です

↓クリックしていただけると嬉しいです〜