Multiple line plotting in one graph - how to automatically adjust the x- and y-axis to find all graphs

107 Views Asked by At

Following from my previous question here R: Select vector (numeric) from data frame, sample n=10 subsets of size i=5 and i= 10 within vector and calculate mean for each of these samples

I want to plot the distribution of the resulting 2 vectors. I am using epdfPlot to create one density and then the second one adding it to the plot, however, I have the problem that the xlim and ylim are adjusted for graph I plot first but not for the graph(s) added.

epdfPlot(as.numeric(unlist(vector1)),
     curve.fill = TRUE,
     curve.fill.col = rgb(1, 0, 0, alpha = 0.5),
     epdf.col = "red",
     )

epdfPlot(as.numeric(unlist(IRR_mean_diversified)),
         curve.fill = TRUE,
         curve.fill.col = rgb(0, 0, 1, alpha = 0.5),
         epdf.col = "blue",
         add = TRUE)

I tried with min/max function of the values, however, that truncates the graphs.

Thank you!

0

There are 0 best solutions below