Hi, you could also use a factor variable to differentiate your observed and estimated values and change shape and/or color based on that factor.
e.g. ggplot(aes(x=X,y=Y, shape=factor(Type))) + geom_point() #For changing shapes ggplot(aes(x=X,y=Y, color=factor(Type))) + geom_point() #For changing colors ggplot(aes(x=X,y=Y, color=factor(Type), shape=factor(Type))) + geom_point() #For changing colors Ista also gave a good solution, but if you ever have more than two sets of points/lines to plot on the same graph you will have a simpler and faster way of doing it. Also, if your data is set into different columns and you do not have a factor, you can use the melt() function in the package reshape2. Your data will be melted into one line with the value beside the variable i.e. the column name which can be used as a factor. Cheers. JM Le vendredi 16 août 2013 05:45:21 UTC-4, Chris89 a écrit : > > Hi! > I am having a difficulty adding additional points to a plot using > ggplot2.. > > The case is that I want to plot both original and estimated values in the > same graph, and general I would use > plot and then lines, but I do not know how to do it with ggplot... > > Thanks! > > Regards, > Chris > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Adding-additional-points-to-ggplot2-tp4673928.html > > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > r-h...@r-project.org <javascript:> mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.