Re: [R] two graphs in one figure?

From: hadley wickham <h.wickham_at_gmail.com>
Date: Thu, 10 Apr 2008 10:34:43 -0500

On Thu, Apr 10, 2008 at 8:36 AM, ONKELINX, Thierry <Thierry.ONKELINX_at_inbo.be> wrote:
> Dear Anne-Katrin,
>
> You could use ggplot to do this. The example below works, although it generates some warnings.
>
> library(ggplot2)
> dataset <- data.frame(x = 0:55, y = rnorm(56, 10), z = runif(56, 9, 11))
> ggplot(data = dataset) + geom_bar(aes(x = factor(x), y = y), position = "dodge") + geom_line(aes(x = x, y = z))

ggplot(data = dataset, aes(factor(x), y)) + geom_bar() + geom_line(aes(y=z, group=1))

does basically the same thing, but without warnings.

Hadley

-- 
http://had.co.nz/

______________________________________________
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 Thu 10 Apr 2008 - 15:56:38 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 Thu 10 Apr 2008 - 16:30:28 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