フィルターのクリア

how to plot a Patch variable type

4 ビュー (過去 30 日間)
Hamid Radmard Rahmani
Hamid Radmard Rahmani 2018 年 12 月 2 日
回答済み: Star Strider 2018 年 12 月 2 日
I have saved a Patchline from a figure in a variable using findobj function:
figure(1);
patchVar = findobj(gcf, 'type', 'patch');
now, how can I plot that in another figure?

回答 (1 件)

Star Strider
Star Strider 2018 年 12 月 2 日
You have to re-plot it with a second patch call:
x = linspace(-1, 1);
y1 = 1.5*x.^2+1;
y2 = x.^2 + 1.5;
figure(1)
patchVar = patch([x, fliplr(x)], [y1 fliplr(y2)], 'g'); % Create ‘patch’ Object
figure(2)
patch(patchVar.XData, patchVar.YData, patchVar.FaceColor)
Also, you do not need the findobj call (although it works, and returns the same information as the handle), you can simply create a handle to the original patch object.

カテゴリ

Help Center および File ExchangePolygons についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by