Re: [R] Using metric units in plots

From: Gavin Simpson <gavin.simpson_at_ucl.ac.uk>
Date: Fri, 20 Jun 2008 13:08:52 +0100

On Fri, 2008-06-20 at 09:09 -0200, Alberto Monteiro wrote:
> Philip Rhoades wrote:
> >
> > This is a bit confusing - as far as I can see, ALL the pars use
> > inches? I understand the US effect but shouldn't Metric units be
> > supported directly?
> >
> That's one of my complains, but it seems that this will take time.
> I don't believe it would be too hard to implement metric parameters
> in every function.

But it is not too difficult to do this yourself:

in2cm <- function(x) return(x * 2.54)

cm2in <- function(x) return(x * 0.3937008)

then use in2cm() or cm2in() depending on what you want to achieve. If you want a margin of 4cm all round the plot:

op <- par(mai = cm2in(rep(4, 4)))
plot(1:10)
par(op)

HTH G

>
> Maybe Humanity must lose a few more people in airplane crashes
> or nuclear plant meltdowns before we ban those unscientific units
> from use.
>
> Alberto Monteiro
>
> ______________________________________________
> 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
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

______________________________________________
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.
Received on Fri 20 Jun 2008 - 12:18:42 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 25 Jun 2008 - 21:31:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive