密度图切断并删除 ggplot2 中的附加线
Density plot cut off and remove additional line in ggplot2
我想去除图片上的水平绿线,我该怎么做?
这张图我用了 ggplot2
,这是 Shiny 应用程序的输出。
p1 <- ggplot(dat = dat, aes(x = as.numeric(dura), col = TYPE_DE_TERMINAL)) +
stat_ecdf(geom = "step") +
scale_colour_brewer(name = "Terminal", palette = "Set1") +
theme(axis.text = element_text(size = 15), legend.justification = c(1, 0),
legend.position = c(1, 0), axis.text.x = element_text(angle = 45, vjust = 1, hjust=1)) +
ylab("CDF") + xlab("Duration") + theme_bw() +
scale_y_continuous(limits=c(0,1), labels= percent) +
ggtitle("Cumulative distribution function of 3G connections duration (in s)") + scale_x_continuous(limits=c(0, 50))
print(p1)
这是我数据的 str()。
我刚找到响应,我使用 stat_density() 而不是 geom_density() 并添加参数 geom="line" 和 position="identity".
我想去除图片上的水平绿线,我该怎么做?
这张图我用了 ggplot2
,这是 Shiny 应用程序的输出。
p1 <- ggplot(dat = dat, aes(x = as.numeric(dura), col = TYPE_DE_TERMINAL)) +
stat_ecdf(geom = "step") +
scale_colour_brewer(name = "Terminal", palette = "Set1") +
theme(axis.text = element_text(size = 15), legend.justification = c(1, 0),
legend.position = c(1, 0), axis.text.x = element_text(angle = 45, vjust = 1, hjust=1)) +
ylab("CDF") + xlab("Duration") + theme_bw() +
scale_y_continuous(limits=c(0,1), labels= percent) +
ggtitle("Cumulative distribution function of 3G connections duration (in s)") + scale_x_continuous(limits=c(0, 50))
print(p1)
这是我数据的 str()。
我刚找到响应,我使用 stat_density() 而不是 geom_density() 并添加参数 geom="line" 和 position="identity".