unable to select data-points in a plot

13 vues (au cours des 30 derniers jours)
M K P Dev
M K P Dev le 15 Juil 2021
Modifié(e) : M K P Dev le 17 Juil 2021
I need to programmatically generate a plot in which I need to dynamically select and deselect data points. which I am not able to do using the following code:
y = [2.091666958,1.929444472,1.954580163,1.903415586,1.875379629,1.875379629,1.903415586,1.875379629,1.942330552,1.903415586,1.903415586,1.929750906,1.942330552]'
x = [7.163732175,7.009281649,5.203296758,7.0004477,7.087439702,7,7.012988611,7.002354474,5.274252552,5.38274806,7.000976802,7,5.321121833]'
UIAxes = uiaxes
UIAxes.XGrid = 'on';
UIAxes.YGrid = 'on';
UIAxes.XMinorGrid = 'on';
UIAxes.YMinorGrid = 'on';
UIAxes.YScale='log';
UIAxes.XScale='log';
starting_x = [1 1];
fitfun = fittype(@(a0,a1,x) a0+(a1.*x));
[fitobject,gof,output] = fit(x,y,fitfun,'StartPoint',starting_x);
fig = figure('Visible','off');
ax = axes(fig);
FigHandle = plot(fitobject,x,y,'or');
hApp = copyobj(FigHandle, UIAxes);

Réponses (1)

Sambit Supriya Dash
Sambit Supriya Dash le 15 Juil 2021
[FDT,ROL] = rmoutliers(y);
OL = y(ROL) % this would be your detected outliers in your dataset (dependent variable)
  1 commentaire
M K P Dev
M K P Dev le 17 Juil 2021
Thank you sambit for the repy.
It was my mistake that I used the words outliers instead of data points.
The problem is that I need to select datapoints graphically from the generated plot. remove them and replot it.
the removed data points should also be shown but with a cross mark, so that I can once again select them and replot the graph.

Connectez-vous pour commenter.

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by