Plotting over an existing plot with ggplot2

Can you post a reprex with some made up data (or real, if it is not sensitive) so that it is clear what you are trying to achieve?

But as a general advice what you can do is create a new dataframe that will contain both datasets in one. Before joining them you can mark them (look into dplyr::bind_rows, it has support for this type of thing). Then you just plot you data and split it by this new column with color/fill/whatever is more suitable. Will this approach work?

Another approach is to add new data directly into ggplot using data argument for any of the layers. For example, something like + geom_point(data = new_data, color = "red") or something.

4 Likes