Question on how to delete the data (outliers) in the boxplot
Show older comments
Hello everyone.
I need to know how to eliminate the representation of outliers (> 95%) in a boxplot representation.
Any suggestion?
Thank you
4 Comments
Adam Danz
on 28 Aug 2020
Does that mean you want to compute and plot the box plots using all of your data and then remove some of the plotted outliers? Or do you want the boxplots to represent the data after outliers are removed?
What does >95% mean? Does it mean values that are larger/smaller than 95% of the median?
Luís Barbosa
on 28 Aug 2020
Binbin Qi
on 28 Aug 2020
I think you can use
rmoutliers(A,'percentiles',threshold)
Accepted Answer
More Answers (1)
As per boxplot's documentation, each aspect of a boxplot is tagged and we can find them with findobj:
ax=axes;
boxplot(ax,[-3,repelem(3:8,10),14]) % Should contain two outliers at y=-3 and y=14.
% Obtain graphics handle for outliers:
o=findobj(ax.Children,'Tag','Outliers');
% We can now change all aspects of the markers:
set(o,'Marker','h','MarkerSize',12)
We could now make the outliers invisible or delete them from the plot, but I encourage folks to read Adam's post above!
% set(o,'Marker','none') % Misleading
% o.Visible = 'off' % Misleading
% delete(o) % Danger, danger!
Let me repeat Adams' words of wisdom that "... removing outlier markers should usually be avoided and can be very deceptive."
Categories
Find more on Box Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
