I am plotting some values (y) across a continuous variable (window) but I would like to change the values on the x-axis to a value class variable (chr) that works as a group variable (one 'chr' value for many 'window' values).
This is an example of the data with my code:
chr<-c(1,1,1,1,1,2,2,2,2,2)
window<-c(1,2,3,4,5,6,7,8,9,10)
y<-c(2,0.5,3,2.5,2,0.2,0.3,0.7,0.3,6)
data <-data.frame(as.character(chr),window,y)
ggplot(data,aes(window,y),coulour=chr)+ geom_point(color=data$chr)
I want to plot the 'y' values agains the 'window' values, but I don't want to see 'window' values on my x-axis - I want to see one (01) 'chr' value that represent all 'window' values for that given 'chr'.
For example, if you run the code above, you'll see the values "2.5", "5.0", "7.5", and "10.0", BUT, I would like to see one "1" for those 'y' values from "0" to "5.0" and one "2" for those 'y' values from "5.0" to "10.0".
Any ideas? Thanks!