How to add a polygon to UIAxes in appdesigner?
3 ビュー (過去 30 日間)
古いコメントを表示
I currently can create a rectangle in the UIAxes with this code:
rect = rectangle(app.UIAxes, 'Position', [0 26 .13 98], 'FaceColor', 'r', 'EdgeColor', 'r');
but what if I want to define where each corner is in the axes. As in, not a rectangle or any other standard shape. I have looked into the patch object, but this code does not work:
X = [0 0 .13 .13]
Y = [26 124 124 26]
shape = patch(app.UIAxes, app.swathX, app.swathY, 'r');
How can I do that with UIAxes?
2 件のコメント
Greg
2018 年 5 月 11 日
編集済み: Greg
2018 年 5 月 11 日
"but this code does not work:"
How so? What does it do? How is that different from what you expect? Does it throw an error? Post the error if it does.
I would hope
X = [0 0 .13 .13]
Y = [26 124 124 26]
shape = patch(app.UIAxes, app.swathX, app.swathY, 'r');
throws some form of unknown variable/property error, as you define X and Y but use swathX and swathY.
回答 (1 件)
Greg
2018 年 5 月 11 日
ps = polyshape([0,0,.13,.13],[26,124,124,26]); % This is still a rectangle though...
pg = plot(uiaxes,ps);
9 件のコメント
Sean de Wolski
2018 年 5 月 15 日
Is upgrading not an option? App designer is under active development so it gets a lot of new features with each release.
参考
カテゴリ
Help Center および File Exchange で Downloads についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!