Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.0 - 日本語

Change language to:
English - Français - Português

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab manual >> Graphics Library > 2d_plot > plot

plot

2Dプロット

呼び出しの手順

plot(y,<LineSpec>,<GlobalProperty>)
plot(x,y,<LineSpec>,<GlobalProperty>)
plot(x1,y1,<LineSpec1>,x2,y2,<LineSpec2>,...xN,yN,<LineSpecN>,<GlobalProperty1>,<GlobalProperty2>,..<GlobalPropertyM>)
plot(<axes_handle>,...)

パラメータ

x

実数行列またはベクトル. 省略した場合, 1:nであると 仮定されます. ただし, nyパラメータで 指定された曲線の点の数です.

y

実数行列またはベクトル. y はマクロまたはプリミティブ として定義された関数とすることもできます.

<LineSpec>

このオプション引数は文字列で 線を描画する手法を指定するショートカットとして使用されます. LineSpecは指定済みの各y または {x,y} 毎に一つ指定できます. LineSpecはLineStyle,MarkerおよびColorと同時に処理されます (LineSpec参照). これらの指定子はプロットされた線において線の種類,マーカの種類および色を定義します.

<GlobalProperty>

このオプションの引数は, グローバルオブジェクトのプロパティを定義する 一連の命令{PropertyName,PropertyValue} を表し, このプロットで作成された全ての曲線に適用されます. 利用可能なプロパティの全て参照するには GlobalPropertyを参照してください.

<axes_handle>

このオプションの引数は,カレントの軸ではなく axes_handleで 指定した軸の内部にプロットが表示されることを指定します (gca参照).

説明

plot は一連の二次元曲線をプロットします. plot はMatlab構文との互換性を改善するために 修正されています. グラフィックの互換性を改善するために, Matlabユーザは (plot2dではなく) plotを使用してください.

データエントリ仕様 :

本節では,記述を明確化するため,オプションの引数 LineSpecおよび GlobalProperty については言及しません. これはこれらの引数は, ("Xdata", "Ydata" および "Zdata" プロパティを 除く, GlobalProperty参照) エントリデータと干渉しないためです. これら全てのオプション引数を同時に指定することが可能です.

y がベクトルの場合, plot(y) はベクトル y をベクトル 1:size(y,'*')に対してプロットします.

yが行列の場合, plot(y) はyの各列を 1:size(y,1)に対してプロットします.

x および y がベクトルの場合, plot(x,y) は ベクトル y をベクトル xに対してプロットします. ベクトルx および y の要素数は同じである必要があります.

x がベクトルで y が行列の場合, plot(x,y) は y の各列をベクトル xに対してプロットします. この場合,y の列の数は x のエントリの数と同じである必要があります.

xy が行列の場合, plot(x,y) は y の各列をxの同じ列に対してプロットします. この場合,xy の大きさは同じである必要があります.

最後に, x または y が行列の場合, ベクトルは行列の各行または各列に対してプロットされます. この選択は,行列の行また列の次元にベクトルの行または列の次元のどちらが 一致するかに応じて行われます. (x または y のみが)正方行列の場合, 列が行よりも優先されます(以下の例参照).

y はマクロまたはプリミティブとして定義された関数と することも可能です.この場合, x データを(ベクトルまたは行列として)指定する必要があり, 対応するy(x)の計算が暗黙の内に行われます.

LineSpecGlobalProperty 引数は プロットをカスタマイズするために使用されます. 以下に利用可能な全オプションのリストを示します.

LineSpec

このオプションは曲線の描画方法を簡便な方法で 指定する際に使用されます. このオプションは,LineStyle, Marker および Color指定子を含む文字列とする 必要があります.

これらのリファレンスは曖昧さがないように 文字列内で指定することが必要です(順番は重要ではありません). 例えば,ダイヤモンド型の記号を付けた赤い長い破線を指定する場合, 以下のように書くことができます: 'r--d' , '--dire' または '--reddiam' または他のあいまいでない命令, もしくは全体を指定する 'diamondred--' (LineSpec参照)

線の種類,色,マーカの色(および大きさ)も ポリラインエンティティプロパティにより(再)設定できることに 注意してください (polyline_properties参照).

GlobalProperty

このオプションは, LineSpecを使用する よりも多くのオプションを用いて曲線のプロット方法を指定できます. PropertyNameを定義する文字列と その値であるPropertyValue (PropertyNameの型に依存して文字列または整数または...) の組で指定する必要があります. GlobalPropertyにより複数のプロパティ, つまり, LineSpec により利用可能なあらゆるプロパティ, マーカの色(表示色および背景色), 視認性, クリッピング, 曲線の太さ, を設定可能です. (GlobalProperty参照)

これらのプロパティは全て ポリラインエンティティプロパティ (polyline_properties参照) により(再)設定できることに注意してください.

注意

デフォルトでは, 連続したプロットは重ね描きされます. 前のプロットを消去するには, clf()を使用してください. auto_clear モードを デフォルトで有効にするには,次のようにデフォルトの軸を編集してください:

da=gda();

da.auto_clear = 'on'

表示を改善するためにplot関数が親の軸の boxプロパティを修正することがあります. これは,親の軸がplotのコールにより作成されたか, コール前に空である場合に行われます. 軸の一つが原点を中心にしている場合, ボックスは無効となります. その他の場合, ボックスが有効になります.

ボックスプロパティと軸の配置に関する詳細については, axes_propertiesを参照ください.

色を指定しない場合,曲線をプロットする際にデフォルトの色テーブルが 使用されます. 複数の線を描画する際,plotコマンドは自動的に このテーブルに基づき周期的に選択します. 以下に使用される色を示します:

R G B
0. 0. 1.
0. 0.5 0.
1. 0. 0.
0. 0.75 0.75
0.75 0. 0.75
0.75 0.75 0.
0.25 0.25 0.25

コマンド plot を入力することによりデモを見ることができます.

// x initialisation 
x=[0:0.1:2*%pi]';
//simple plot
plot(sin(x))
clf()
plot(x,sin(x))
//multiple plot
clf()
plot(x,[sin(x) sin(2*x) sin(3*x)])
clf()

// axis on the right 
plot(x,sin(x)) 
a=gca(); // Handle on current axes entity 
a.y_location ="right"; 
clf()

// axis centered at (0,0)
plot(x-4,sin(x),x+2,cos(x))
a=gca(); // Handle on axes entity
a.x_location = "origin"; 
a.y_location = "origin"; 

// Some operations on entities created by plot ...
a=gca();
a.isoview='on'; 
a.children // list the children of the axes : here it is an Compound child composed of 2 entities 
poly1= a.children.children(2); //store polyline handle into poly1 
poly1.foreground = 4; // another way to change the style...
poly1.thickness = 3;  // ...and the tickness of a curve.
poly1.clip_state='off' // clipping control
a.isoview='off'; 

//LineSpec and GlobalProperty examples:
clf();
t=0:%pi/20:2*%pi;
plot(t,sin(t),'ro-.',t,cos(t),'cya+',t,abs(sin(t)),'--mo')
scf(2)
plot([t ;t],[sin(t) ;cos(t)],'xdat',[1:2])
scf(3)
axfig3 = gca();
scf(4) // should remain blank
plot(axfig3,[t ;t],[sin(t) ;cos(t)],'zdat',[1:2],'marker','d','markerfac','green','markeredg','yel')
xdel(winsid())

//Data specification
t=-%pi:0.1:%pi;
size(t)
plot(t) // simply plots y versus t vector size
clf(); // clear figure

plot(t,sin(t)); // plots sin(t) versus t
clf();

t=[1     1     1     1
   2     3     4     5
   3     4     5     6
   4     5     6     7];

plot(t) // plots each t column versus row size
clf();

subplot(221)
plot(t,sin(t)); // plots sin(t) versus t column by column this time
xtitle("sin(t) versus t")
subplot(222)
plot(t,sin(t)')
xtitle("sin(t)'' versus t")
subplot(223)
plot(t',sin(t))
a=gca();
a.data_bounds=[0 -1;7 1]; // to see the vertical line hiddden by the y axis
xtitle("sin(t) versus t''")
subplot(224)
plot(t',sin(t)')
xtitle("sin(t)'' versus t''")

clf();

//Special case 1
//x : vector ([5 6 7 8]) and y : matrix (t)
x=[5 6 7 8]
plot(x,t);
plot(x',t); // idem, x is automatically transposed to match t (here the columns)
clf()

// Only one matching possibility case : how to make 4 identical plots in 4 manners...
// x is 1x4 (vector) and y is 4x5 (non square matrix)
subplot(221);
plot(x,[t [8;9;10;12]]');
subplot(222);
plot(x',[t [8;9;10;12]]');
subplot(223);
plot(x,[t [8;9;10;12]]');
subplot(224);
plot(x',[t [8;9;10;12]]');
clf()

//Special case 2
// Case where only x or y is a square matrix
//x : matrix (t) and y  : vector ([1 2 3 4])
plot(t,[1 2 3 4]) // equivalent to plot(t,[1 1 1 1;2 2 2 2;3 3 3 3;4 4 4 4])
plot(t,[1;2;3;4]) // the same plot
clf();

// t is transposed : notice the priority given to the columns treatment
plot(t',[1 2 3 4]) // equivalent to plot(t',[1 1 1 1;2 2 2 2;3 3 3 3;4 4 4 4]) 
plot(t',[1 2 3 4]') // the same plot 
clf();

// y is a function defined by..
// ..a primitive
plot(1:0.1:10,sin) // equivalent to plot(1:0.1:10,sin(1:0.1:10))
clf();

// ..a macro:
deff('[y]=toto(x)','y=x.*x')
plot(1:10,toto)

作者

F.Leray

<< paramfplot2d 2d_plot plot2d >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Jan 26 16:25:11 CET 2011