getLayout
クラス: matlab.graphics.chartcontainer.ChartContainer
パッケージ: matlab.graphics.chartcontainer
構文
tcl = getLayout(obj)
説明
は tcl
= getLayout(obj
)matlab.graphics.chartcontainer.ChartContainer
基底クラスから継承するチャート オブジェクトのタイル表示チャート レイアウトを返します。
入力引数
obj
— クラスのオブジェクト
チャート オブジェクト
matlab.graphics.chartcontainer.ChartContainer
基底クラスから継承するクラスのオブジェクト。
出力引数
tcl
— タイル表示チャート レイアウト オブジェクト
TiledChartLayout
オブジェクト
TiledChartLayout
オブジェクト。極座標プロット、地理プロット、または複数のプロットのタイル配置が含まれるチャートを作成している場合、tcl
を使用します。タイルの数、各 axes オブジェクトの位置、タイルの間隔など、レイアウトの一部の特性を設定できます。
例
直交座標プロットと極座標プロットを左右に並べて表示
直交座標と極座標でデータをプロットする CartPolarPlot
と呼ばれるクラスを定義します。
このクラスを定義するには、次の機能をもつ以下のクラス定義を含む CartPolarPlot.m
というファイルを作成します。
座標データを保存する
XData
とYData
、およびラインの色を制御するLineColor
の 3 つのパブリック プロパティ2 つの line オブジェクトと axes オブジェクトを保存する 4 つのプライベート プロパティ
レイアウトを設定し、座標軸を作成し、2 つの
Line
オブジェクトを初期化するsetup
メソッドユーザーが 1 つ以上のパブリック プロパティの値を変更した場合に
Line
オブジェクトを更新するupdate
メソッド
classdef CartPolarPlot < matlab.graphics.chartcontainer.ChartContainer properties XData (1,:) double = NaN YData (1,:) double = NaN LineColor (1,3) double {mustBeGreaterThanOrEqual(LineColor,0),... mustBeLessThanOrEqual(LineColor,1)} = [.5 0 1] end properties(Access = private,Transient,NonCopyable) CartesianLine (1,1) matlab.graphics.chart.primitive.Line PolarLine (1,1) matlab.graphics.chart.primitive.Line CartesianAx (1,1) matlab.graphics.axis.Axes PolarAx (1,1) matlab.graphics.axis.PolarAxes end methods(Access = protected) function setup(obj) % Get the layout and create the axes tcl = getLayout(obj); tcl.GridSize = [1 2]; obj.CartesianAx = axes(tcl); obj.PolarAx = polaraxes(tcl); % Move the polar axes to the second tile obj.PolarAx.Layout.Tile = 2; % Create the Cartesian and polar lines obj.CartesianLine = plot(obj.CartesianAx,NaN,NaN); obj.PolarLine = polarplot(obj.PolarAx,NaN,NaN); end function update(obj) % Update Cartesian line obj.CartesianLine.XData = obj.XData; obj.CartesianLine.YData = obj.YData; obj.CartesianLine.Color = obj.LineColor; % Update polar line obj.PolarLine.Color = obj.LineColor; obj.PolarLine.ThetaData = obj.XData; obj.PolarLine.RData = obj.YData; end end end
次に、x 座標と y 座標のセットを作成します。その後、'XData'
と 'YData'
の名前と値のペアの引数を指定して CartPolarPlot
コンストラクター メソッドを呼び出し、座標軸をプロットします。
x = 0:0.01:2*pi; y = sin(2*x).*cos(2*x); CartPolarPlot('XData',x,'YData',y);
バージョン履歴
R2020a で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)