On Feb 7, 2008 5:19 AM, ONKELINX, Thierry <[EMAIL PROTECTED]> wrote:
> Tribo,
>
> Suppose you dataset is called bode. Then "melt" it:
>
> Melted <- melt(bode, id.var = c("frequency", "system")
>
> Then you'll get something like.
>
> frequency | system | variabele | value
> 0 | system 1 | phase | 0
> 0 | system 1 | gain | 100
>
> then this line below should do the trick (untested)
>
> ggplot(Melted, aes(x = frequency, y = value, colour = system)) +
> geom_line() + facet_grid(system ~ .) + scale_x_log10()

Although looking at the example, the y axes have different scales -
which you can't currently do in ggplot (although it definitely on the
drawing board).  You might need to do:

bode <-  ggplot(bode, aes(x = frequency, colour = system)) +
geom_line() + facet_grid(system ~ .) + scale_x_log10()

bode + aes(y = phase)
bode + aes(y = gain)

to make two separate plots, and then use grid to join them up on one
page (see the final chapter of the ggplot2 book)

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

______________________________________________
[email protected] 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.

Reply via email to