ubuntuのwxmaxima上にてgnuplotのウインドウキャプチャをとるには

ubuntuのwxmaxima上にてgnuplotのウインドウキャプチャをとるには

ホームにあるmaxout.gnuplotを調べてみると一行目にあるterm指定のせいだった。

~$ head -1 maxout.gnuplot
set term x11 font "Helvetica,16"

gnuplotはデフォルトでwxtで立ち上がってくるのでsedで置換するか一行目を削除する

~$ sed s/x11/wxt/ maxout.gnuplot | gnuplot -persist
~$ sed 1d maxout.gnuplot | gnuplot -persist

一応これでウインドウキャプチャがとれるようになった。

ということで termをx11からwxtにすればいいことが分かったのでヘルプと格闘してgnuplotに渡すオプションがわかった。

plot2d(x^2,[x,-10,10],[gnuplot_term,wxt]);

これで以下のようなtermがwxtとなったグラフを表示するようになる。

無事にウィンドウキャプチャがとれるようになった。

wxmaxima中でデフォルト化するには

set_plot_option([gnuplot_term,wxt]);

とすると、以下はplot2d中で宣言しなくてもいい。

常にこの設定を適用するためには .maximaディレクトリ中にmaxima-init.macというマクロを置けばいい。(maxima-init.lisplispが置ける模様)

~$ mkdir ~/.maxima
~$ cat > ~/.maxima/maxima-init.mac
set_plot_option([gnuplot_term,wxt]);

以上。

追記 2008/10/11 21:34:57:

gnuplot_default_term_commandでも入れ替えることができる。

set_plot_option([gnuplot_preamble,"set zeroaxis lt -1"]);
set_plot_option([gnuplot_default_term_command,"set term wxt"]);