Two scales in the same axis


I'm not sure if it's possible do what I want to. I want to draw an x axis with two scales like the picture below. Thanks a lot,

enter image description here


Answers:


ggplot2 version can look like this:

library(ggplot2)

x = c(1,2,3,4,5, 10,20,30,40,50)
y = c(1,2,2,3,4, 2,1,3,5,5)
# You should introduce cond - condition to separate axises - by yourself
df = data.frame(x=x,y=y,cond=ifelse(x>5,"x2","x1"))

ggplot(df, aes(x,y,group=cond)) + geom_line() + geom_point(aes(shape=cond), size=4) + facet_grid(.~cond, scales="free_x")

Which produces this plot: enter image description here