[R] Plot in Rcmdr

David L Carlson dcarlson at tamu.edu
Tue Jul 14 19:17:06 CEST 2015


It can be changed by slightly modifying the scatterplot() command in the R Script window and re-submitting it.

>From the top menu select Data | Data in packages | Read data set from an attached package. Then type Pottery in the space next to "Enter name of data set" (notice that Pottery is capitalized). 

>From the top menu select Graphs | Scatterplot and then select Al as the x-variable and Ca as the y-variable. Click on Plot by groups... and select Site (and unselect Plot lines by group). Click OK and OK again to produce the plot. The legend is outside the plot region and the top margin has been expanded to make room for it.

In the R Script window you will see the command:

scatterplot(Ca~Al | Site, reg.line=lm, smooth=TRUE, spread=TRUE, 
  id.method='mahal', id.n = 2, boxplots='xy', span=0.5, by.groups=FALSE, 
  data=Pottery)

add a single argument to the end of the command so that it looks like this:

scatterplot(Ca~Al | Site, reg.line=lm, smooth=TRUE, spread=TRUE, 
  id.method='mahal', id.n = 2, boxplots='xy', span=0.5, by.groups=FALSE, 
  data=Pottery, legend.coords="topright")

Then select all three lines and click Submit:

The new plot puts the legend in the upper right corner of the plot region. R Commander uses the scatterplot() function from package ca to create the plot. It has several options that are not included on the options dialog window in R Commander, but can be accessed simply by editing the command that R Commander creates.

To see these options type

?scatterplot

On an empty line in the R Script window, put the cursor on the line and click Submit. This will open your web browser with the manual page for scatterplot.

-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352



-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of INGRAM Joanne
Sent: Tuesday, July 14, 2015 9:53 AM
To: r-help at R-project.org
Subject: [R] Plot in Rcmdr

Hello,

I wondered if anyone could help me with a small issue in Rcmdr.  

I have used the 'Graphs' function in the drop-down menu to create a scatterplot for groups (gender).  But when I do this the legend (telling me the symbols which represent male etc.) keeps obscuring the title of the plot.  Does anyone know how to fix this problem - within Rcmdr?

Please note I am not looking for help with creating the graph in another way (for example in R).  I am specifically trying to figure out if this can be fixed in Rcmdr.  If the answer is "No - this cannot currently be changed within Rcmdr" I would still like to hear from you.

Many thanks for any help.

Joanne Ingram
Research Associate (Medical Statistics)
Centre for Population Health Science
University of Edinburgh

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.



More information about the R-help mailing list