1
2

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のグラフを一括plotしてみた

Last updated at Posted at 2020-02-01

はじめに

こんにちは!Qiita初投稿です。
大学の授業のOpenCVの課題提出で出力画像のヒストグラムをgnuplotで毎回変換しなければならず鬱になっていました。

そこで、シェルスクリプトを使ってディレクトリ内にあるすべてのtxtファイルをepsに変換してplotするプログラムをつくりました。

やったこと

  • シェルスクリプトのお勉強

フォルダ内のtxtファイルをすべてgnuplotでplot 

ググりながら作りました。プログラムの先頭に#/bin/shは必ずいるようです。

test.sh
#!/bin/sh

for f in *.txt;
do
gnuplot<<EOF
#gnuplotでのx軸の設定値
set xrange [0:256]
set xtics 0, 64, 256

#txtをplotデータに変換
plot "$f" with boxes
set terminal postscript eps
set output "${f%.txt}.eps"
replot
quit
EOF
done
1
2
1

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?