I have created a complex plot g
with ggplot with a number of series with different colors. Now, I'd like to add a few points with a manual color, without bothering about the colors of all the pre-existing series.
For example, if I do this
g + geom_point(data = dd, aes_string(x = xseries, y = yseries, color = "red" ) )
it doesn't work, obviously, because it's expecting a factor variable because it wants to associate colors to values of a variable in the data frame dd
.
Another trial was to assign a variable to those points (say redpoint
, so the data frame dd
would contain columns "xseries", "yseries" and "redpoint") like this:
g + geom_point(data = dd, aes_string(x = xseries, y = yseries, color = "redpoint" ) )
Now, people advice to use scale_color_manual
to manually define colors. However, if I do that I should explicitly state all the colors of the data series that are in g
, which is quite problematic as they are several tens and it took me a while to assign them the colors I want.
So, is there a method to add points with a manual color without specifying all the colors of the pre-existing plot?