Graphical data selection tool

버전 1.0.0.0 (10.2 KB) 작성자: John D'Errico
A graphical tool to modify your plots and locate data points
다운로드 수: 15.5K
업데이트 날짜: 2007/2/20

라이선스 보기

편집자 메모: This file was a File Exchange Pick of the Week

Selectdata is a tool that allows the user to graphically select one or more points from a 2-d plot using a variety of graphical tools. You can specify a lasso tool, a paint brush of two shapes and various sizes, an expanding rectangle, or just click near a desired point.

As points are selected with the tool of choice, they become highlighted (temporarily) until the mouse button is released. Then the index of the points selected, plus their (x,y) coordinates are returned. The user has control of many aspects of the tool, including whether the selected points are to be deleted from the plot. (There are also some hidden options that I did not include in the help itself. You can find them by editing the file.)

I wrote this tool as a generic utility one could call from within a gui based modeling application. It could also be useful when called directly from the commandline to identify data points or sets of points on a plot, or to delete points (outliers) from a plot. It can be used to return the points selected or all of those that remained unselected. In my own use of this tool, I use it to identify sets of points for which I wish to modify the regression weights.

Some examples of use:

Simple selection with a lasso - I selected one point from one of the two curves, and two points from the second curve.

plot(rand(5,2),rand(5,2),'o')
[pind,xs,ys] = selectdata('selectionmode','lasso')
pind =
[ 3]
[2x1 double]
xs =
[ 0.099422]
[2x1 double]
ys =
[ 0.87571]
[2x1 double]

Selection with a circular brush, deleting those selected from the plot.

plot(rand(5,2),rand(5,2),'o')
[pind,xs,ys] = selectdata('sel','br','action','delete')
pind =
[3]
[4]
xs =
[0.67745]
[0.69115]
ys =
[0.76837]
[0.59464]

Plot two curves, one is data, the second a model. Allow the selection tool (the lasso) to only see the data.

x = 0:.01:1;
y = exp(x);
ydata = y + randn(size(y))/2;

h1 = plot(x,y,'r-');
hold on
h2 = plot(x,ydata,'o');
[pind,xs,ys] = selectdata('sel','lasso','ignore',h1)

pind =
20
78
99
xs =
0.19
0.77
0.98
ys =
2.3639
3.2279
3.7707

Thanks to Jiro and a reviewer for some great ideas for the enhancements implemented in version 2.

Version 3 has the ability to label each selected point with its coordinates.

Please send me e-mail if you find any problems.

인용 양식

John D'Errico (2024). Graphical data selection tool (https://www.mathworks.com/matlabcentral/fileexchange/13857-graphical-data-selection-tool), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2006b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Fit Postprocessing에 대해 자세히 알아보기
태그 태그 추가

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0

Version 3: Added the option of displaying the (x,y) coordinates of each selected point on the plot.