2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

gnuplotチートシート

Last updated at Posted at 2019-01-28

標準入力から渡した値をプロットする

gnuplot -p -e "plot '< cat -' using 1:2 with lines"

from: https://stackoverflow.com/questions/4585770/gnuplot-stdin-how-to-plot-two-lines

y=sin(x)

seq -w 0 0.01 6.28 |
awk '{print $1, sin($1)}' |
gnuplot -p -e "plot '< cat -' using 1:2 with lines"
y=sin(x) のグラフ

image.png

反比例 y=1/x

seq 1 100 |
awk '{print $1, 1/$1}' |
gnuplot -p -e "plot '< cat -' using 1:2 with lines"
y=1/x のグラフ

image.png

日付のフォーマットを指定する

set xdata time
set timefmt '%Y%m%d%H%M%S'

参考: http://lowrank.net/gnuplot/datetime.html

線とか点とかのスタイルを指定する

凡例を非表示にする

unset key

PNGで出力する

set terminal pngcairo size 2560,1800
set output './plot.png'

下付き文字などを無効にする

terminalの設定にnoenhancedをつけると下付き文字などを表示する拡張テキストモードが無効化される。

例:

set terminal svg size 640,480 font 'Verdana,10' noenhanced

点でなく線で描画する

with linesをつけると線で描画してくれる。

plot 'data.txt' using 1:2 title 'data 1' with lines

xticsで時間軸を設定する

2
4
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
2
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?