I have two data sets, their size is 500 and 1000. I want to plot density for these two data sets in one plot.
I have done some search in google.
- r-geom-density-values-in-y-axis
- ggplot2-plotting-two-or-more-overlapping-density-plots-on-the-same-graph/
the data sets in above threads are the same
df <- data.frame(x = rnorm(1000, 0, 1), y = rnorm(1000, 0, 2), z = rnorm(1000, 2, 1.5))
But if I have different data size, I should normalize the data first in order to compare the density between data sets.
Is it possible to make density plot with different data size in ggplot2?