Hi R users

The scatterplot (used package R-Cmdr ) obtained has the legend off the
plot in the upper left 
I would like to decide where to put the legend - is that option still
available and how do I do it? 
code: 
Dataset <- read.table("J:/Pigmatingsb.txt", header=TRUE, sep="\t",
na.strings="NA", dec=".", strip.white=TRUE)
scatterplot(Farrowing.rate~Time.in.Weeks | Operator, reg.line=lm,
smooth=FALSE, labels=FALSE, boxplots=FALSE, span=0.5, by.groups=TRUE,
ylab="Farrowing Rate", xlab="Time in Weeks", font.lab=2, cex.lab=1.5,
cex.axis=1.2, pch=c(16,15,24,3), data=Dataset)

The other option was to use the following which allowed manipulation of
the legend but had its own problems as I wasn't entirely sure how to
produce a simple regression line for the scatter for each group?


library(lattice)
setwd("C:\\temp")
Dataset <- read.table("Pigmatingsb.txt", header=TRUE, sep="\t",
na.strings="NA", dec=".", strip.white=TRUE)
head(Dataset)

xyplot(Farrowing.rate~Time.in.Weeks, groups= Operator, type=c("p"data =
Dataset,layout = c(1, 1), panel=panel.superpose ,xlab="Time
(weeks)",ylab="Farrowing rate", key = list(points =
Rows(trellis.par.get("superpose.symbol"), 1:4),
                           text = list(levels(Dataset$Operator)),
                           columns = 4)) 

Regards

Andy

Andrew McFadden MVS BVSc
Incursion Investigator
Investigation & Diagnostic Centres - Wallaceville Biosecurity New 
Zealand Ministry of Agriculture and Forestry

Phone 04 894 5600 Fax 04 894 4973 Mobile 029 894 5611 Postal address: 
Investigation and Diagnostic Centre- Wallaceville Box 40742 Ward St 
Upper Hutt


########################################################################
This email message and any attachment(s) is intended solely for the
addressee(s) named above. The information it contains is confidential
and may be legally privileged.  Unauthorised use of the message, or the
information it contains, may be unlawful. If you have received this
message by mistake please call the sender immediately on 64 4 8940100
or notify us by return email and erase the original message and
attachments. Thank you.

The Ministry of Agriculture and Forestry accepts no responsibility for
changes made to this email or to any attachments after transmission from
the office.
########################################################################

        [[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.

Reply via email to