문제

I want to select data using a polygonal shape. I understand roipoly does that for 'images'. is there something like this for scatter plots?

도움이 되었습니까?

해결책

You can use data brushing to mark data on a scatter plot then extract it to the workspace. Look for the little brush symbol at the top of a figure window.

See Marking up graphs with Data Brushing from Matlab, and Accessing plot brushed data from the very useful Undocumented Matlab.

If you want to draw a complex polygon, you can use impoly and inpoly:

X = rand(200, 2);
scatter(X(:,1), X(:,2));

h = impoly();
% now you go and position the polygon, control returns once you've 'finsished' with it '

nodes = getPosition(h);
selected_indices = inpoly(X, nodes);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top