MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   将散点图变成面积图 (https://www.labfans.com/bbs/showthread.php?t=24022)

poster 2019-12-10 20:48

将散点图变成面积图
 
我在MATLAB中有一个2D散点图。是否可以对散点图进行插值以创建面积图?



[B]回答:[/B]

如果您只是想在整个散布点周围绘制一个大的填充多边形,则可以使用函数[URL="http://www.mathworks.com/help/techdoc/ref/convhull.html"]CONVHULL[/URL]查找包含点的凸包,并使用[URL="http://www.mathworks.com/help/techdoc/ref/patch.html"]PATCH[/URL]显示凸包:

x = rand(1,20); %# 20 random x values y = rand(1,20); %# 20 random y values hullPoints = convhull(x,y); %# Find the points defining the convex hull patch(x(hullPoints),y(hullPoints),'r'); %# Plot the convex hull in red hold on; %# Add to the existing plot scatter(x,y); %# Plot your scattered points (for comparison) 这是结果图:

[IMG]https://i.stack.imgur.com/W5Sri.png[/IMG]



[url=https://stackoverflow.com/questions/3965627]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 23:11

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.