0

I have two data set, I need to plot them in same graph. Here is the two dataset.

The following is the code I used to plot the data. How to plot above data in same plot ? How to set the graph legend on the x-axis? I tried setting it but it didn't work I got some error.

m_bs = conpl$new(sample_data1$V1)
m_eq = conpl$new(sample_data2$V1)

est = estimate_xmin(m_bs, xmax=5e+5)
est_eq = estimate_xmin(m_eq, xmax=Inf)

m_bs$setXmin(est_bs)
m_eq$setXmin(est_eq)

plot(m_bs)
lines(m_bs)
d = plot(m_eq, draw =FALSE)
points(d$x, d$y, col=2)

lines(m_eq,col=2,lwd=2)

Kindly let me know thanks.

user128956
  • 123
  • 1
  • 14

1 Answers1

1

You code works find for me when I used simulated data. However, I think your problem is with your data. In particular, you need to set the xlim values in your plot command. Something like:

min_x = min(sample_data1$V1, sample_data1$V2)
max_x = max(sample_data1$V1, sample_data1$V2)
plot(m_bs, xlim=c(min_x, max_x))

Should do the trick. To add a legend, just use the legend function

legend("bottomleft", col=1:2, legend = c("BS", "EQ"), lty=1)
csgillespie
  • 59,189
  • 14
  • 150
  • 185