Plotting two differnt data frames in the same graph

I want to plot two data frames in the same plot I tried to use

ggplot()+
  geom_line(data= All_PMHCA, aes(x=Pos_0, y=Hg, colour= "Hg") )+
  geom_point(data= PMHCA_count,aes(x=Year, y= dot, colour= "Year"))

but it didnt work, are there other ways to go about it?

Thank you!

Could you turn this into a reprex (reproducible example), which would make it easier for people to help you?

At first glance I'd say take the quotes away from around the variables in the colour aesthetic, but you haven't said what error or warnings you get (if any), or presented any data so there may be other stuff going on too.

Ron.

Thank you ! that was my mistake!

This isn't actually a reproducible example, since we don't have your data

See the FAQ on how to do a minimal reprex for beginners, below:

However, it looks like you're trying to plot two different datasets with no shared variables on the same chart, which isn't going to work, since there's no way to map one to the other.

Could you maybe describe what you're trying to do, and we might be able to help you from there?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.