Ruby/libplot

GNU libplot の ruby インタフェース

Module/Class Hierarchy

Libplot -+
         |
         +- Libplot::PlotterParams
         |
         +- Libplot::Plotter

Module Libplot

定数

Class Libplot::PlotterParams

Class Methods

Libplot::PlotterParams.new()

PlotterParams クラスを生成して返す。

Methods

Libplot::PlotterParams#setplparam(parameter, value)

パラメータ parameter を値 value に設定する。

Class Libplot::Plotter

Class Methods

Libplot::Plotter.new(type, infile, outfile, errfile, plotter_params)

Plotter クラスを生成して返す。 type には生成するファイルの種類を以下のいずれかで指定する。 "X", "Xdrawable", "png", "pnm", "gif", "svg", "ai", "ps", "cgm", "fig", "pcl", "hpgl", "regis", "tek", "meta"

Methods

初期化、終了、設定関係

Libplot::Plotter#openpl()

新しいプロット(ページ)を開始する。 失敗した場合、負の値が返ってくる。

Libplot::Plotter#closepl()

プロット(ページ)を終了する。 失敗した場合、負の値が返ってくる。

Libplot::Plotter#erase()

プロットを消去する。

Libplot::Plotter#flushpl()

バッファされて書き出されていないプロットの内容をフラッシュする。 これは real-time plotting なプロッタ(X Plotters, X Drawable Plotters, ReGIS Plotters, Tektronix Plotters, and Metafile Plotters) のみで有効である。

Libplot::Plotter#havecap(s)

Plotter の能力、性質を調べる。

グラフィック/座標関係

Libplot::Plotter#space(x0, y0, x1, y1)
Libplot::Plotter#fspace(x0, y0, x1, y1)

ユーザ座標を左下角の座標 (x0, y0) 右上角の座標 (x1, y1) に設定する。 Libplot::Plotter#openpl() を呼び出した直後に設定する必要がある。

Libplot::Plotter#space2(x0, y0, x1, y1, x2, y2)
Libplot::Plotter#fspace2(x0, y0, x1, y1, x2, y2)

Libplot::Plotter#space の拡張版

Libplot::Plotter#fsetmatrix(M0, M1, M2, M3, TX, TY)

Postscript スタイルの座標行列変換 [M0 M1 M2 M3 TX TY] を行う。

Libplot::Plotter#fconcat(M0, M1, M2, M3, TX, TY)
Libplot::Plotter#frotate(theta)

座標系を回転する。 [cos(THETA) sin(THETA) -sin(THETA) cos(THETA) 0 0]

Libplot::Plotter#fscale(x, y)

座標系を拡大、縮小する。

Libplot::Plotter#ftranslate(x, y)

座標原点をを (x, y) に設定する。

グラフィック/描画関係

Libplot::Plotter#move(x, y)
Libplot::Plotter#fmove(x, y)

カレントポイントを座標 (x, y) に移動する。

Libplot::Plotter#moverel(dx, dy)
Libplot::Plotter#fmoverel(dx, dy)

カレントポイントを相対座標 (dx, dy) に移動する。

Libplot::Plotter#point(x, y)
Libplot::Plotter#fpoint(x, y)

カレントパスを終了し、座標 (x, y) に点を描画する。 カレントポイントは座標 (x, y) に移動する。

Libplot::Plotter#pointrel(dx, dy)
Libplot::Plotter#fpointrel(dx, dy)

カレントパスを終了し、相対座標 (dx, dy) に点を描画する。 カレントポイントは相対座標 (dx, dy) に移動する。

Libplot::Plotter#cont(x, y)
Libplot::Plotter#fcont(x, y)

カレントポイントから座標 (x, y) に線を引く。 カレントポイントは座標 (x, y) に移動する。

Libplot::Plotter#contrel(x, y)
Libplot::Plotter#fcontrel(dx, dy)

カレントポイントから相対座標 (dx, dy) に線を引く。 カレントポイントは相対座標 (dx, dy) に移動する。

Libplot::Plotter#line(x0, y0, x1, y1)
Libplot::Plotter#fline(x0, y0, x1, y1)

(x0, y0) から (x1, y1) まで線を引く。 カレントポイントは座標 (x1, y1) に移動する。

Libplot::Plotter#linerel(dx0, dy0, dx1, dy1)
Libplot::Plotter#flinerel(dx0, dy0, dx1, dy1)

(x0, y0) から (x1, y1) まで線を引く。 カレントポイントは相対座標 (dx1, dy1) に移動する。

Libplot::Plotter#bezier2(x0, y0, x1, y1, x2, y2)
Libplot::Plotter#fbezier2(x0, y0, x1, y1, x2, y2)

座標 (x0, y0) から座標 (x2, y2) までベジエ曲線を引く。 座標 (x1, y1) にはベジエ曲線の controll points を指定する。

Libplot::Plotter#bezier2rel(dx0, dy0, dx1, dy1, dx2, dy2)
Libplot::Plotter#fbezier2rel(dx0, dy0, dx1, dy1, dx2, dy2)

相対座標 (dx0, dy0) から相対座標 (dx2, dy2) までベジエ曲線を引く。 相対座標 (dx1, dy1) にはベジエ曲線の controll points を指定する。

Libplot::Plotter#bezier3(x0, y0, x1, y1, x2, y2, x3, y3)
Libplot::Plotter#fbezier3(x0, y0, x1, y1, x2, y2, x3, y3)

座標 (x0, y0) から座標 (x3, y3) までベジエ曲線を引く。 座標 (x1, y1), (x2, y2) にはベジエ曲線の controll points を指定する。

Libplot::Plotter#bezier3rel(dx0, dy0, dx1, dy1, dx2, dy2, dx3, dy3)
Libplot::Plotter#fbezier3rel(dx0, dy0, dx1, dy1, dx2, dy2, dx3, dy3)

相対座標 (dx0, dy0) から相対座標 (dx3, dy3) までベジエ曲線を引く。 相対座標 (dx1, dy1), (dx2, dy2) にはベジエ曲線の controll points を指定する。

Libplot::Plotter#box(x0, y0, x1, y1)
Libplot::Plotter#fbox(x0, y0, x1, y1)

左下角の座標 (x0, y0) 右上角の座標 (x1, y1) の四角を描く。 カレントポイントは座標 (x1, y1) に移動する。

Libplot::Plotter#boxrel(dx0, dy0, dx1, dy1)
Libplot::Plotter#fboxrel(dx0, dy0, dx1, dy1)

左下角の相対座標 (dx0, dy0) 右上角の相対座標 (dx1, dy1) の四角を描く。 カレントポイントは相対座標 (dx1, dy1) に移動する。

Libplot::Plotter#circle(x, y, r)
Libplot::Plotter#fcircle(x, y, r)

中心座標 (x, y)、半径 r の円を描く。

Libplot::Plotter#circlerel(dx, dy, r)
Libplot::Plotter#fcirclerel(dx, dy, r)

中心が相対座標 (x, y)、半径 r の円を描く。

Libplot::Plotter#arc(xc, yc, x0, y0, x1, y1)
Libplot::Plotter#farc(xc, yc, x0, y0, x1, y1)

中心座標 (xc, yc)、開始座標 (x0, y0) 終了座標 (x1, y1)の円弧を描く。

Libplot::Plotter#arcrel(dxc, dyc, dx0, dy0, dx1, dy1)
Libplot::Plotter#farcrel(dxc, dyc, dx0, dy0, dx1, dy1)

中心が相対座標 (dxc, dyc)、開始点が相対座標 (dx0, dy0) 終了点が相対座標 (dx1, dy1)の円弧を描く。

Libplot::Plotter#ellipse(x, y, rx, ry, angle)
Libplot::Plotter#fellipse(x, y, rx, ry, angle)

中心座標 (x, y)、X, Y方向の長さが それぞれ rx, ry の角度 angle| の楕円を描く。

Libplot::Plotter#ellipserel(dx, dy, rx, ry, angle)
Libplot::Plotter#fellipserel(dx, dy, rx, ry, angle)

中心の相対座標 (dx, dy)、X, Y方向の長さが それぞれ rx, ry の角度 angle| の楕円を描く。

Libplot::Plotter#ellarc(xc, yc, x0, y0, x1, y1)
Libplot::Plotter#fellarc(xc, yc, x0, y0, x1, y1)

中心座標 (xc, yc)、開始座標 (x0, y0) 終了座標 (x1, y1)の楕円弧?を描く。

Libplot::Plotter#ellarcrel(dxc, dyc, dx0, dy0, dx1, dy1)
Libplot::Plotter#fellarcrel(dxc, dyc, dx0, dy0, dx1, dy1)

中心が相対座標 (dxc, dyc)、開始点が相対座標 (dx0, dy0) 終了点が相対座標 (dx1, dy1)の楕円弧?を描く。

グラフィック/マーカー関係

Libplot::Plotter#marker(x, y, type, size)
Libplot::Plotter#fmarker(x, y, type, size)

座標 (x, y) に type で指定する大きさ size のマーカーを描画する。 type には 0 から 31 まで指定できる。

Libplot::Plotter#markerrel(dx, dy, type, size)
Libplot::Plotter#fmarkerrel(dx, dy, type, size)

相対座標 (dx, dy) に type で指定する大きさ size のマーカーを描画する。 type には 0 から 31 まで指定できる。

グラフィック/path 関係

Libplot::Plotter#closepath()
Libplot::Plotter#endpath()

カレントパスを閉じる。

Libplot::Plotter#endsubpath()

グラフィック/状態関係

Libplot::Plotter#savestate()
Libplot::Plotter#restorestate()

現在のグラフィック関係の状態をセーブ、リストアする。

グラフィック/設定関係

Libplot::Plotter#linewidth(size)
Libplot::Plotter#flinewidth(size)

線の幅を size で設定する。

Libplot::Plotter#pentype(level)

ペンのレベルを設定する。 level が 1 の場合は pencolor や pencolorname で 設定した色で描画する。1 がデフォルトになっている。 level が 0 の場合はパスが描画されない。

Libplot::Plotter#filltype(level)

塗りつぶし程度を設定する。 level が 0 の場合は塗りつぶさない。0 がデフォルトになっている。 level は 0x0000...0xffff つまり 0...65535 の範囲で設定できる。

Libplot::Plotter#linemod(s)

線種を s に設定する。s として指定できるのは、 "solid", "dotted", "dotdashed", "shortdashed", "longdashed", "dotdotdashed", "dotdotdotdashed", "disconnected" のいずれか。

"solid"             --------------------------------
"dotted"            -   -   -   -   -   -   -   -
"dotdashed"         ----   -   ----   -   ----   -
"shortdashed"       ----    ----    ----    ----
"longdashed"        -------    -------    -------
"dotdotdashed"      ----   -   -   ----   -   -
"dotdotdotdashed"   ----   -   -   -   ----   -   -   -
Libplot::Plotter#linedash(dashes, offset)
Libplot::Plotter#flinedash(dashes, offset)

破線のパタンを設定する。

Libplot::Plotter#capmod(s)

線の端の描画方法を s に設定する。s として指定できるのは "butt" (デフォルト), "round", "projecting" のいずれか。

Libplot::Plotter#joinmod(s)

折れ線の角の描画方法を s に設定する。s として 指定できるのは "miter" (デフォルト), "round", and "bevel" のいずれか。

Libplot::Plotter#fillmod(s)

塗りつぶしの方法を s に設定する。s として指定できるのは "even-odd"(デフォルト), "nonzero-winding" のいずれか。

Libplot::Plotter#fmiterlimit(limit)

miter limit を limit に設定する。

Libplot::Plotter#orientation(direction)

circles, ellipses, and boxes の回転方向を指定する。 direction が 1 の場合は時計反対回り、 -1 の場合は時計回りとなる。

グラフィック/色関係

Libplot::Plotter#bgcolor(red, green, blue)

背景色を設定する。値は 0x0000...0xffff すなわち 0...65535 の範囲である。 (0, 0, 0) は黒、(65535, 65535, 65535) は白を指定したことになる。

Libplot::Plotter#bgcolorname(name)

背景色を設定する。解釈できない色は白とみなされる。 色は 24ビット RGB "#c0c0c0" 形式で指定できる。 また、/usr/local/share/libplot/colors.txt などにある "red", "blue" などでも指定できる。

Libplot::Plotter#color(red, green, blue)
Libplot::Plotter#colorname(name)

色を設定する。Libplot::Plotter#pencolor と Libplot::Plotter#fillcolor を 同時に呼び出したことと同じである。

Libplot::Plotter#fillcolor(red, green, blue)
Libplot::Plotter#fillcolorname(name)

塗りつぶす色を設定する。

Libplot::Plotter#pencolor(red, green, blue)
Libplot::Plotter#pencolorname(name)

ペンの色を設定する。

フォント関係

Libplot::Plotter#fontname(s)
Libplot::Plotter#ffontname(s)

フォントをフォント名 s に設定する。

Libplot::Plotter#fontsize(size)
Libplot::Plotter#ffontsize(size)

フォントの大きさを size に設定する。

テキスト関係

Libplot::Plotter#alabel(x_justify, y_justify, s)

文字列 s をカレントポイントに描画する。 x_justify に 'l', 'c', 'r' を指定することで X 方向の左、中央、右揃えをする。 y_justify に 'b', 'x', 'c', 't' を指定することで Y方向の下、ベースライン、中央、上揃えをする。

Libplot::Plotter#label(s)

文字列 s をカレントポイントに左詰めで描画する。 カレントポイントは文字右端に移動する。 Libplot::Plotter#alabel('l', 'x', s) と同じ。

Libplot::Plotter#labelwidth(s)
Libplot::Plotter#flabelwidth(s)

文字列 s の長さを返す。

Libplot::Plotter#textangle(angle)
Libplot::Plotter#ftextangle(angle)

文字列の描画角度を X 軸から時計と反対周りの angle に設定する。 カレントフォントサイズを返す。