inst/examples/rnorm-boxplot2.R

# ggplot2 绘制箱线图的凹槽与统计推断图
library(ggplot2)
x = rnorm(150)
y = rnorm(50, 0.8)
p = ggplot(
  data.frame(num = c(x, y), idx = c(rep("x", 150), rep("y", 50)))) +
  geom_boxplot(aes(x = idx, y = num, fill = idx), notch = TRUE) +
  coord_flip()
print(p)

Try the MSG package in your browser

Any scripts or data that you put into this service are public.

MSG documentation built on July 22, 2021, 1:06 a.m.