gnuplot for Windows で,グラフをクリップボード経由で PowerPoint に貼ると,何故かグレーになってしまったバグが 4.2.5 で修正された。
■ ■ ■
gnuplot はグラフを描くのに便利なソフトである (gnuplot homepage)。Windows Vista Business で gnuplot for Windows を使っていて困っていたことがあった。それは,グラフをクリップボードにコピーして,PowerPoint に貼り付けると,グラフの線がグレーの点線になってしまっていた。

Version 4.2.4
使用バージョンは Version 4.2 patchlevel 4 である (配布ファイル名は gp424win32.zip)。グラフのタイトルバーで右クリック→「Options」→「Copy to Clipboard」でクリップボードにコピーし,PowerPoint に貼り付けると,上のようになってしまっていた。仕方ないので,IrfanView に貼り付け,それをまたクリップボードにコピーして PowerPoint に貼り付けていた。しかし,その手を使うと,画像形式になってしまうので,拡大縮小するとエッジがぼやけてしまうという欠点があった。
上のグラフを描画するためのコマンドは次の通り。
gnuplot> unset mouse
gnuplot> plot sin(x)*sin(x)

Version 4.2.5
2009年3月30日にリリースされた Version 4.2 patchlevel 5 (配布ファイル名は gp425win32.zip) を使ってみると,この問題が解消されていた。すばらしい。SourceForge からダウンロードできる (gnuplot development | Get gnuplot development at SourceForge.net)。
クリップボードにコピーされるグラフはベクトル形式である。なので,PowerPoint 上で拡大縮小すると,グラフは拡大縮小されるが,文字は同じ大きさのままになる。便利なんだか,便利じゃないんだか分からない。
上のグラフを描画するためのコマンドは次の通り。
gnuplot> unset mouse
gnuplot> set term windows enhanced font 'Arial 16'
gnuplot> plot [][-.2:1.2] sin(x)*sin(x) title 'sin^2({/Symbol x})'
gnuplot は,Version 4.2 から windows ターミナルのオプションに「enhanced」が選択できるようになった (デフォルトは noenhanced)。「enhanced」にすることで,これまでパッチを当てるか PostScript ターミナルを使うことでしかできなかった,「^2」で上付き,{/Symbol x} で「ξ」などの表示ができるようになっている (nlog(n): 「4次元よりも無限次元…」の図の描き方)。アルファベットとギリシャ文字の対応については ラベルにα,βの様なギリシャ文字を使いたい が詳しい。

enhancedtext.dem
その他「enhanced」でできる機能については,デモが教えてくれる。
gnuplot> load '../demo/enhancedtest.dem'
すべてのデモを見るには,ディレクトリを demo に移してから「all.dem」をロードする。「こんなことができるかな? →できるよ」が網羅されている。
gnuplot> cd '../demo'
gnuplot< load 'all.dem'
アンテナパターンを描画するデモは「poldat.dem」,特異点を持つガンマ関数を描画するデモは「prob.dem」である。
データのポイントを表すマークはターミナルによって変わる。これについては nlog(n): gnuplot のマーカ を参照。
いつも使い方が分からなくなってしまうのがマウスである。右クリックで範囲を指定すると拡大してくれるのはいいのだが,戻し方が分からなくなってしまう。正解は「描画ウィンドウ上で 'p'」。その他のキーバインドについては,コマンドラインで「bind」と入力すると表示される。
gnuplot> bind
2x<B1> print coordinates to clipboard using `clipboardformat`
(see keys '3', '4')
<B2> annotate the graph using `mouseformat` (see keys '1', '2')
or draw labels if `set mouse labels is on`
<Ctrl-B2> remove label close to pointer if `set mouse labels` is on
<B3> mark zoom region (only for 2d-plots and maps).
<B1-Motion> change view (rotation). Use <ctrl> to rotate the axes only.
<B2-Motion> change view (scaling). Use <ctrl> to scale the axes only.
<Shift-B2-Motion> vertical motion -- change xyplane
Space raise gnuplot console window
q * close this X11 plot window
a `builtin-autoscale` (set autoscale keepfix; replot)
b `builtin-toggle-border`
e `builtin-replot`
g `builtin-toggle-grid`
h `builtin-help`
l `builtin-toggle-log` y logscale for plots, z and cb logscale for splots
L `builtin-nearest-log` toggle logscale of axis nearest cursor
m `builtin-toggle-mouse`
r `builtin-toggle-ruler`
1 `builtin-decrement-mousemode`
2 `builtin-increment-mousemode`
3 `builtin-decrement-clipboardmode`
4 `builtin-increment-clipboardmode`
5 `builtin-toggle-polardistance`
6 `builtin-toggle-verbose`
7 `builtin-toggle-ratio`
n `builtin-zoom-next` go to next zoom in the zoom stack
p `builtin-zoom-previous` go to previous zoom in the zoom stack
u `builtin-unzoom`
Right `builtin-rotate-right` only for splots; <shift> increases amount
Up `builtin-rotate-up` only for splots; <shift> increases amount
Left `builtin-rotate-left` only for splots; <shift> increases amount
Down `builtin-rotate-down` only for splots; <shift> increases amount
Escape `builtin-cancel-zoom` cancel zoom region
* indicates this key is active from all plot windows
このヘルプにもあるように,マウスの使用を不可にするのに,上では「unset mouse」を使ったが,「描画ウィンドウ上で 'm'」を押すだけで,使用可・不可を切り替えることができる。
Posted by n at 2009-07-09 05:41 | Edit | Comments (0) | Trackback(0)