Skip to content

Instantly share code, notes, and snippets.

@yuki-tkd
Last active February 7, 2020 00:59
Show Gist options
  • Save yuki-tkd/c2e880d3004ac39e37c7583069ec1d18 to your computer and use it in GitHub Desktop.
Save yuki-tkd/c2e880d3004ac39e37c7583069ec1d18 to your computer and use it in GitHub Desktop.
Gnuplotでエラーバー付きの棒グラフを描画する方法
# ファイル名
file = "tv"
# png出力&フォントをヒラギノに
set term png font "ヒラギノ丸ゴ ProN W4, 8"
# 出力ファイル名設定
set output file.".png"
#タブ区切りのファイルを開く
set datafile separator "\t"
# 棒グラフの幅を1に
set boxwidth 1
# グラフの左右の余白を1に
set offsets 1, 1, 0, 0
# 系列名のオフセット
set xtics offset 1, 0
# エラーバーの色がborderの色で決まるので, borderを黒色に
set style fill solid border lc rgb "black"
# y軸は0~6の間
set yrange [0:6]
# 塗りはパターン (出力形式によってパターン変わるので, testコマンドで色確認すること)
set style fill pattern
plot file.".dat" using ($0*3+0):2:3:xtic(1) with boxerrorbars fill pattern 3 lw 1 lc rgb "red" title "システム無し",\
file.".dat" using ($0*3+1):4:5 with boxerrorbars fill pattern 1 lw 1 lc rgb "blue" title "システム有り"
replot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment