I want to use ggplot2 and reshape to draw multiple densities on the same plot, tried this is my code and error,


#1
ggplot(dummyc, aes(x = dummyc$Total.Value.of.Supplies,colour = dummyc$Tax.Period.Year)) +
    geom_density()

library(reshape)
df.m = melt(dummyc)
ggplot(df.m) + geom_freqpoly(aes(x = dummyc$Total.Value.of.Supplies,
                                 y=..density..))

Error: Aesthetics must be either length 1 or the same as the data (495): x


#2

We do not have your data to reproduce the problem and not a lot of information to understand what you want to do. With your data (or a subset) it will be easier to help.

Could you ask this with a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.


#3

Alright, I want to combine probability density functions in the same plot. I have a data frame with several variables and I want to visualize them in the same plot.