#FIG1
ggplot(mylayer2, aes(x= Value, fill = Condition)) +
geom_density(alpha = .5)+
xlim(0.2,0.8)+
ylim(0,4)
#FIG2
ggplot(mylayer2, aes(x= Value, fill = Condition)) +
geom_density(alpha = .5)
I am using ggplot in R to visualise two groups of data. However, there is a gap/cracking part in the density plot of condition 1(FIG1). When I remove xlim() and ylim() then there's no gap anymore(FIG2). Is there a way I could fix it?
#original data
structure(list(Value = c(0.4375, 0.28125, 0.65625, 0.46875, 0.4375,
0.5625, 0.53125, 0.59375, 0.4375, 0.3125, 0.5, 0.4375, 0.53125,
0.375, 0.5, 0.40625, 0.53125, 0.5625, 0.34375, 0.59375, 0.5,
0.4375, 0.4375, 0.46875, 0.34375, 0.53125, 0.5625, 0.5625, 0.28125,
0.46875, 0.625, 0.5, 0.4375, 0.375, 0.5, 0.25, 0.40625, 0.40625,
0.3125, 0.46875, 0.5625, 0.375, 0.46875, 0.375, 0.375, 0.40625
), Condition = c("1", "1", "1", "1", "1", "1", "1", "1", "1",
"1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1", "1",
"1", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2",
"2", "2", "2", "2", "2", "2", "2", "2", "2", "2", "2")), row.names = c(NA,
-46L), class = c("tbl_df", "tbl", "data.frame"))