gnuplot
たまーに使うけどよく使い方を忘れるのでメモ。
#!perl my $dir = shift; my $title=shift; $title or die "$0 image-dir 'title'\n"; my @ss; { open(IN,"$dir.info") or die "cant read $dir.info $!\n"; my $a=; $a =~ s/[\x00-\x20]+//g; warn "$a\n"; @ss = grep{length} split/,/,$a; close(IN) or die "cant read $dir.info $!\n"; } my $xmin=1/10000; my $xmax=0; for(@ss){ my $str = $_; s/^\!// or $_= 1/$_; # warn qq("$str" $_,\\\n); $_>$xmax and $xmax=$_; } $xmax *=1.2; my $ymax=0; my $emax=0; my @list; for(sort <$dir/*>){ next if -d; my $d = `tool/dcraw-analysis.exe $_`; $d =~ s/[\x0d\x0a]+//g; my @d =grep{length} split/\s+/,$d; my $ss = shift @ss; my @a=($ss); while(@d){ my($ave,$err,$max,$min)=splice @d,0,4; $max>$ymax and $ymax=$max; $err>$emax and $emax=$err; push @a,($ave,$err,$max,$min); } push @a,$_; push @list,\@a; } warn "xmin=$xmin\n"; warn "xmax=$xmax\n"; warn "ymax=$xmax\n"; warn "emax=$emax\n"; open(OUT,">$dir.txt") or die "cant write $dir.txt $!\n"; for(@list){ my $name= pop @$_; print OUT join(' ',@$_)," # $name\n"; } close(OUT) or die "cant write $dir.txt $!\n"; $ymax *=1.2; open(OUT,">$dir.plt") or die "cant write $dir.plt $!\n"; print OUT <<"END"; reset set terminal png size 640 480 xf8f8f8 x222222 x444444 xff0000 x00ff00 x0000ff set lmargin 10 set key left top set logscale set time set ylabel "luminance" set xlabel "shutter speed" set grid set xtics border \\ ("" 0.000125 ,"4000" 0.00025 \\ ,"" 0.0005 ,"1000" 0.001 \\ ,"" 0.002 ,"250" 0.004 \\ ,"" 0.008 ,"60" 0.0167 \\ ,"" 0.033 ,"15" 0.067 \\ ,"" 0.125 ,"4" 0.25 \\ ,"" 0.5 ,"1" 1 \\ ,"" 2 ,"4''" 4 \\ ) set output "$dir.png" set title "$title" set xrange [0.0001:$xmax] set yrange [1:$ymax] plot "$dir.txt" using 1:2:3 with yerrorlines pt -1 title "Red" ,\\ "" using 1:6:7 with yerrorlines pt -1 title "Green" ,\\ "" using 1:10:11 with yerrorlines pt -1 title "Blue" END close(OUT) or die "cant write $dir.plt $!\n"; unlink "$dir.png"; my $cmd ="gnuplot/wgnuplot.exe $dir.plt"; warn "$cmd\n"; system($cmd);