Graphical data selection tool

A graphical tool to modify your plots and locate data points
15,4K Downloads
Aktualisiert 20 Feb 2007

Lizenz anzeigen

Anmerkung des Herausgebers: 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.

Zitieren als

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

Kompatibilität der MATLAB-Version
Erstellt mit R2006b
Kompatibel mit allen Versionen
Plattform-Kompatibilität
Windows macOS Linux
Kategorien
Mehr zu Fit Postprocessing finden Sie in Help Center und MATLAB Answers
Tags Tags hinzufügen

Community Treasure Hunt

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

Start Hunting!
Version Veröffentlicht Versionshinweise
1.0.0.0

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