Dear Karin, If I understand correctly what you want, the scatterplot function in the car package isn't designed to produce it, but there are many ways to draw side-by-side scatterplots. Here is one, using basic R graphics:
par(mfrow=c(1,2)) by(Data, Data$group, function(x) { plot(Pulls ~ Resistance, data=x, main=paste("group =", group[1])) abline(lm(Pulls ~ Resistance, data=x)) } ) This assumes that your data are in a data frame named Data, with variables group, Pulls, and Resistance. I hope this helps, John ------------------------------ John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada web: socserv.mcmaster.ca/jfox > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of nonu...@yahoo.de > Sent: April-26-09 5:30 AM > To: r-help@r-project.org > Subject: [R] Scatterplot of two groups side-by-side? > > Dear all > > I'm realy new to R, so I hope you can help me, as I didn't find any solution > in the common books. > > Since some days I'm trying to create the following plot: A scatterplott > showning two different groups side-by-side with according regression lines. > Both datasets only have the same five factors, so the scatters will form a > kind of column at each factor. When I use "scatterplot" (package "car"), then > I can plot two groups in the same graph by using the command "groups", but > the scatters of both groups are then plotted on top of eachother using > different symbols and they can hardly be distingushed. How can I plot them > side by side, so that the groups do not overlap? And how can I give different > colours to the groups and the according regression line?(This is, what I got > so far: http://img7.imageshack.us/img7/227/almostgood.jpg) > > I tried to use the commands used in "boxplot", to solve this problem. In this > commant, it's possible to plot different datasets side-by-side by defining > the position of the bars (example: at = 1:5 - 0.4). A second boxplot-chart > can then be added by adding the command "add=TRUE" to the line and defining > another position. Both commands don't function within the scatterplot- > command. > > By the way: It's realy necessary to plott the data as scatters and not as > boxplots. With the command "plot", I can not plot the data by groups (I tried > it with the commands "subset" and "groups", but obviously, there is no way to > do so). > > I'm greatful for every (simple) solution > Thanks in advance > > Karin Schneeberger > MSc-student > University of Berne > Switzerland > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. ______________________________________________ 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.