From: Benjamin Otto <b.otto_at_uke.uni-hamburg.de>

Date: Thu 21 Dec 2006 - 09:50:49 GMT

Date: Thu 21 Dec 2006 - 09:50:49 GMT

Hi Knut, hi Greg,

Thanks for the quick help!

@Greg:

Yes THAT’S exactly what I meant. Thanks for the example.

@Knut:

Thanks for the hint. However my problem was that the combination of "plot"
and grid wasn't working. But probably it isn't supposed to.

Regards

Benjamin

Knut wrote:

> Did you find these manuals for the Grid package?

> http://www.stat.auckland.ac.nz/~paul/grid/doc/rotated.pdf

> http://www.stat.auckland.ac.nz/~paul/grid/grid.html

> Regards Knut

-----Ursprüngliche Nachricht-----

Von: Greg Snow [mailto:Greg.Snow@intermountainmail.org]
Gesendet: 20 December 2006 20:34

An: Benjamin Otto; R-Help

Betreff: RE: [R] Rotating a distribution plot by 90 degrees

Does the following code do what you want?

x <- c( rnorm(50,10,2), rnorm(30,20,2) ) y <- 2+3*x + rnorm(80)

d.x <- density(x)

d.y <- density(y)

layout( matrix( c(0,2,2,1,3,3,1,3,3),ncol=3) )

plot(d.x$x, d.x$y, xlim=range(x), type='l') plot(d.y$y, d.y$x, ylim=range(y), xlim=rev(range(d.y$y)), type='l') plot(x,y, xlim=range(x), ylim=range(y) )

If not, be more specific in describing what you want.

Hope this helps,

-- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow@intermountainmail.org (801) 408-8111 -----Original Message----- From: r-help-bounces@stat.math.ethz.ch [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Benjamin Otto Sent: Wednesday, December 20, 2006 3:55 AM To: R-Help Subject: [R] Rotating a distribution plot by 90 degrees Hi, Can I rotate a plot (e.g. a distribution plot) by 90 degrees? The barplot function provides the "horiz" command but that's not availeable for the base package functions. I found an old advice from Paul Murrell on a similar problem suggesting to use viewports (grid package). Yet I couldn't reproduce his examples successfully. And going through the examples in the current grid package help pages left me with the feeling that viewport and the plot/points function don't match because the latter automatically clears the old device. Is there some way to rotate a "plot" at all or am I forced to use the barplot function instead? Regards, Benjamin P.S.: For further explanation: I would like to plot something like +-----+-----+ | | | | 0 | 1 | | | | +-----+-----+ | | | | 2 | 3 | | | | +-----+-----+ where image 1 is some function plot in normal mode, image 2 is a function plot rotated by 90 degrees and image 3 is something depending on the two functions. -- Benjamin Otto Universitaetsklinikum Eppendorf Hamburg Institut fuer Klinische Chemie Martinistrasse 52 20246 Hamburg ______________________________________________ R-help@stat.math.ethz.ch 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@stat.math.ethz.ch 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 Dec 22 06:40:50 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Thu 21 Dec 2006 - 21:30:27 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.
*