unable to select data-points in a plot

조회 수: 8 (최근 30일)
M K P Dev
M K P Dev 2021년 7월 15일
편집: M K P Dev 2021년 7월 17일
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);

답변 (1개)

Sambit Supriya Dash
Sambit Supriya Dash 2021년 7월 15일
[FDT,ROL] = rmoutliers(y);
OL = y(ROL) % this would be your detected outliers in your dataset (dependent variable)
  댓글 수: 1
M K P Dev
M K P Dev 2021년 7월 17일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Smoothing and Denoising에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by