MENU

溶けかけてるうさぎ HP GALLERY BLOG TOP RECENT ARTICLES POPULAR ARTICLES ABOUT THIS BLOG

CATEGORY

大学 (137) 仕事 (27) 航空宇宙 (106) 写真 (79) 旅行 (33) 飯・酒 (17) コンピュータ (128) その他 (48)

TAG

ARCHIVE

RECENT

【自宅サーバー】10年以上使ってきた HDD の状況確認と復旧作業 AI がここまで身近になり思うこと 【自宅サーバー】VPN サーバーの更新 必要範囲で切り抜くことで衛星データを高速にダウンロード ふと 博士号について

【gnuplot】複数データの棒グラフのコマンドセット

事象発生日:2018-02-28

記事公開日:2018-02-28

アクセス数:54739

gnuplotのコマンドセットの備忘録 その4.

 

今回は,複数データの棒グラフを作成する.

1.実行環境

Microsoft Windows 10 Home (64bit)

Gnuplot Version 5.2 patchlevel 0

2.データフォーマット

軸目盛りと,2種のデータを並べているだけである.

#   last year   this year
Mar 35.71       179.69
Apr 83.33       232.76
:     :           : 
データファイル

3.コマンドセットと出力

set key left top
set yrange[0:]

set style data histogram
set style histogram cluster gap 1
set style fill solid
# set boxwidth 0.5

set ylabel "Average Power [W]"

plot "plot.dat" using 2:xtic(1) title "last year" linecolor rgb "light-blue", \
             '' using 3         title "this year" linecolor rgb "light-red"

set tics    font "Consolas,12"
set key     font "Consolas,12"
set title   font "Consolas,12"
set xlabel  font "Consolas,12"
set ylabel  font "Consolas,12"
set terminal pdf enhanced color size 6.0in, 4.5in
set output "W.pdf"
replot
set output
set terminal wxt
コマンドセット
PDF出力画像

4.Tips

棒グラフ・ヒストグラム

ヒストグラムモードにセット.

set style data histogram

棒グラフの間隔調整

以下のコマンドで棒グラフの間隔を変えられる.

set style histogram cluster gap 1

軸目盛りをデータファイルから

以下のように,using 2:xtic(1)でデータファイルの1列を目を軸目盛りにセットできる.

plot "plot.dat" using 2:xtic(1) title "last year" linecolor rgb "light-blue", \

5.出典サイト

Official gnuplot documentation. gnuplot 5.0. Retrieved October 11, 2017, from http://www.gnuplot.info/docs_5.0/gnuplot.pdf

関連記事

コメントを投稿

名前

Email (※公開されることはありません)

コメント