Re: [R] Control of x-axis variable ordering in ggplot

2015-10-23 Thread sbihorel
Hi, I want to thank Jeff, Dennis, c06n, and Hadley for their replies and explanations. As you probably guessed, I am fairly new to ggplot am trying to loose my lattice reflex while transitioning to ggplot. Thank for the link to the ggplot external documentation. Sebastien On 10/23/2015 7:15

Re: [R] Control of x-axis variable ordering in ggplot

2015-10-23 Thread c06n
Hi, are you trying to do the same thing with ggplot as with lattice? In this case, your solution looks probably like this: ggplot(data, aes(x, y, group = g)) + geom_path(aes(colour = g)) If you haven’t done so yet, I strongly recommend reading through the ggplot2 documentation: http://doc

Re: [R] Control of x-axis variable ordering in ggplot

2015-10-23 Thread Hadley Wickham
You have two problems: * geom_line() always draws from right-to-left * you're defining colour outside of the plot in a very non-ggplot2 way. Here's how I'd do it: library(ggplot2) data <- data.frame( x = rep(1:4, each = 25), y = rep(1:25, times = 4), g = rep(1:4, each = 25) ) data$x <- dat

Re: [R] Control of x-axis variable ordering in ggplot

2015-10-22 Thread Jeff Newmiller
The ggplot function has no display behaviour. You have to couple it with a geom function to define how the data will be displayed. Read ?geom_line and ?geom_poly. --- Jeff NewmillerThe .