我想創建一個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