How to plot a filled rectangle without edge?

36 ビュー (過去 30 日間)
Mr M.
Mr M. 2015 年 9 月 28 日
回答済み: DGM 2024 年 10 月 5 日
'EdgeColor', 'None' makes the outline width to be zero?

採用された回答

Toshia M
Toshia M 2024 年 10 月 4 日
Starting in R2024b, you can specify a name-value argument (EdgeColor="none") to remove the edge lines.
pcolor(rand(10,10),EdgeColor="none")
If you're running an earlier version of MATLAB, you can return the surface object as an output argument and set the EdgeColor property after you call pcolor.
figure
s = pcolor(rand(10,10));
s.EdgeColor = "none";

その他の回答 (2 件)

Image Analyst
Image Analyst 2015 年 9 月 28 日
Set the edge color to the same color value as the "FaceColor'

DGM
DGM 2024 年 10 月 5 日
Disregarding recent changes to options handling, this seems like it was always an adequately answerable question. It was just unclear what "filled rectangle" meant. I don't remember when dot notation started to be accepted here, but the same should have been practical using get()/set() in versions which might have been expected 10 years ago.
% use a rectangle object?
hr = rectangle('position',[1 1 15 10],'curvature',0.5);
hr.FaceColor = 'r';
hr.EdgeColor = 'none';
xlim([0 17])
ylim([0 12])
% use a patch object?
x = [1 1 16 16];
y = [1 11 11 1];
hp = patch(x,y,'r');
hp.EdgeColor = 'none';
xlim([0 17])
ylim([0 12])

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by