Using ggplot function, it is possible to group/color the column of interest and plot the data based on that as follows:
ggplot(inputDataFrame, aes(as.numeric(interestingColumn) , group = AnotherColumn)) +
coord_cartesian(xlim = c(0,400)) + geom_line(stat='ecdf')
How can I also add the curve/plot regarding the whole data in "interestingColumn" regardless of the "group" criteria. So that I can compare the whole data and its subdivision groups in one plot.
For instance, running the above code, I will get the figure as follows and I will get the cumulative values for each product separately. How can I add a plot to the following plot which shows the whole products consumption regardless of the product group.
Thanks.
You can add a
geom_line
without the color aesthetics and ageom_line
with the color aesthetics. Also see below how to create a reproducible example.