# data that defines the range of x values you are interested in
DF <-data.frame(x = c(1,8))
ggplot(DF, aes(x=x)) +
stat_function(fun = d(G1), aes(colour = 'G1')) +
stat_function(fun = d(G2), aes(colour = 'G2')) +
scale_colour_manual('Distribution',
values = setNames(c('red', 'blue'), c('G1', 'G2')))
1 回答
使用ggplot
你可以用
stat_function
例如
使用基础
distr::plot
的帮助文件显示了如何组合绘图 .您需要自己设置
mfrow
(或mfcol
),然后在绘图调用中设置mfColRow =FALSE
.例如: