On Fri, 2008-12-19 at 13:06 +0000, Kelly-Gerreyn B.A.
wrote:> Dear Help
>
> I'm new to R (from matlab)...using windows XP.
>
> I've tried to work out, to no avail, 4 things:
>
> 1) rotating the numbers on axes...something to do with par(str) ??
?par and argument 'las' for basic control. There is a FAQ that explains
how to get more control of the rotating:
http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-create-rotated-axis-labels_003f
>
> 2) how to close a window having opened one e.g. windows(7,7)
[ click on the close button in the window title bar? ;-) ]
More seriously, if you are looking for a R function to do it, dev.off()
closes the currently active device.
dev.list() shows the devices open on your system, dev.cur() tells you
which device is currently active and dev.set() switches between opened
devices; since from your question I'm guessing you have more than one
opened at a time.
>
> 3) how to manipulate the key (e.g. dots, lines etc) on the legend.
> Using pch just gives me the same key for all functions on a plot.
Provide a vector of plotting characters, e.g. 'pch = 1:6'. 'pch'
only
controls the plotting character; 'lwd' controls widths of lines,
'lty'
line types. All accept vectors of 'types' so you can specify exactly
what you need.
>
> i.e. legend ("right",
legend=c("Model","Obs"), pch= 16 )...in this
> case both Model and Obs are filled circles!
>
> 4) how to add error bars (SE or STD) to an xy plot
?arrows
arrows() is the easiest way to cook this up yourself from standard
graphics calls. Just draw an arrow from value+error to value-error on
the axis that has the error. For example, using dummy data:
dat <- data.frame(A = rnorm(10, mean = 3, sd = 2),
B = rnorm(10, 10, sd = 4),
C = rnorm(10, 35, sd = 6))
## something to plot
mns <- colMeans(dat)
## some uncertainty
err <- 2 * sd(dat)
## compute space for means +/- err
ylims <- range(c(mns + err, mns - err))
## plot
plot(mns, ylim = ylims)
## add error bars
arrows(1:3, mns + err, 1:3, mns - err, code = 3,
angle = 90, length = 0.1)
There are functions in several packages to simplify this process for
you. Do:
RSiteSearch("error bars", restrict="functions")
in your R session for lots of hits.
These are all fairly basic R fundamentals. Perhaps, if you haven't
already done so, take a look at the manual 'An Introduction to R' that
comes with R or one of the several user contributed documents:
http://cran.r-project.org/other-docs.html
HTH
G
>
> The last is the most important for me right now. All help much
> appreciated.
>
> Many thanks
>
> Boris
>
>
> Dr. Boris Kelly-Gerreyn
>
> Voiced with
Dragon<http://www.nuance.com/naturallyspeaking/preferred/>
<http://www.nuance.com/naturallyspeaking/preferred/> NaturallySpeaking v9
>
> <http://www.nuance.com/naturallyspeaking/preferred/>Ocean
Biogeochemistry & Ecosystems <http://www.noc.soton.ac.uk/obe/>
> National Oceanography Centre,
Southampton<http://www.noc.soton.ac.uk/>
> Waterfront Campus, European Way
> Southampton, SO14 3ZH, UK
> Tel : +44 (0) 2380 596334
> Sec : +44 (0) 2380 596015
> Fax : +44 (0) 2380 596247
> e-m: bag'@'noc.soton.ac.uk
>
> Friday Seminar <http://www.noc.soton.ac.uk/nocs/friday_seminars.php>
Series
>
> <http://www.noc.soton.ac.uk/nocs/friday_seminars.php>This e-mail (and
any attachments) is confidential and intended solely for the use of the
individual or entity to whom it is addressed. Both NERC and the University of
Southampton (who operate NOCS as a collaboration) are subject to the Freedom of
Information Act 2000. The information contained in this e-mail and any reply
you make may be disclosed unless it is legally exempt from disclosure. Any
material supplied to NOCS may be stored in the electronic records management
system of either the University or NERC as appropriate.
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL:
<https://stat.ethz.ch/pipermail/r-help/attachments/20081222/3da8af1b/attachment.bin>