[R] plotting horizontally
Marc Schwartz (via MN)
mschwartz at mn.rr.com
Tue Jul 26 21:47:43 CEST 2005
On Tue, 2005-07-26 at 08:58 +0700, dkf at specere.com wrote:
> Hello,
>
> Is there any way to use plot() horizontally similar to
> boxplot(....., horiz=TRUE)? I want to use to illustrate
> the distribution of y-values on an adjacent plot using
> layout().
>
> Thanks in advance for any help.
>
> Regards,
>
> --Dan
Have you looked at the last example in ?layout, which has a scatterplot
with marginal histograms for the x and y axes?
Alternatively, you can generally reverse the x and y values for most
plots. For example, compare:
d <- density(rnorm(100))
# Vertical density plot
plot(d)
# Horizontal density plot
plot(d$y, d$x, type = "l", xlab = "Density",
main = "density(y = rnorm(100))",
ylab = paste("N =", d$n, " Bandwidth =", formatC(d$bw)))
HTH,
Marc Schwartz
More information about the R-help
mailing list