R语言ggplot2绘制鸢尾花数据集的分面图
以下是使用ggplot2包和iris数据集绘制的分面图:
library(ggplot2)
data(iris)
ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) +
geom_point(aes(color = Species)) +
facet_wrap(~ Species, nrow = 1)
这将绘制三个面板,每个面板显示一个Iris品种的散点图,其中x轴为萼片长度,y轴为萼片宽度。颜色编码表示不同的品种。 nrow = 1参数指定每行一个面板。
原文地址: https://www.cveoy.top/t/topic/nEHA 著作权归作者所有。请勿转载和采集!