我想创建一个plotly箱线图中的R,这并不表明了异常,我发现在plotly官方页面此链接: https://plot.ly/ggplot2/box-plots/#outliers从箱线图中删除离群plotly
library(plotly)
set.seed(123)
df <- diamonds[sample(1:nrow(diamonds), size = 1000),]
p <- ggplot(df, aes(cut, price, fill = cut)) +
geom_boxplot(outlier.shape = NA) +
ggtitle("Ignore outliers in ggplot2")
# Need to modify the plotly object and make outlier points have opacity equal
to 0
p <- plotly_build(p)
p$data <- lapply(p$data, FUN = function(x){
x$marker = list(opacity = 0)
return(x)
})
# Create a shareable link to your chart
# Set up API credentials: https://plot.ly/r/getting-started
chart_link = plotly_POST(p, filename="geom_boxplot/outliers")
chart_link
的问题是,在他们的网页和我的控制台中,异常值仍在显示。 这是一种错误吗?
随着时间的推移,错误可能会得到修复。 'geom_boxplot(outlier.shape = NA)'给我产生了一个没有异常值的盒子图。 – Ufos