0

I want to plot the vector 4:10 but from 0 to 10. I don't like the large gap in produces, and I want to create my own style of plot, so I write the code:

plot(4:10,axes=FALSE,ylim=c(2,10),xlim=c(0,8))
axis(1,pos=2)
axis(2,pos=0,at=seq(2,10,2),labels=c('0','4','6','8','10'))

In order to not mislead the audience, I want to put in an axis break using axis.break() from plotrix. Unfortunately, when I add

axis.break(2,2.5)

on my plot, I don't get the break where my axis is but where it would be if I used the default axis. How do I get axisbreak() to move with my axis? Or else, how do I put an axis break where I want it?

Plinth
  • 289
  • 1
  • 13

1 Answers1

1

Add pos=0 to your axis.break:

plot(4:10,axes=FALSE,ylim=c(2,10),xlim=c(0,8))
axis(1,pos=2)
axis(2,pos=0,at=seq(2,10,2),labels=c('0','4','6','8','10'))
axis.break(2,2.5,pos=0)

enter image description here

Pierre Lapointe
  • 16,017
  • 2
  • 43
  • 56