0

So I've got a plot with customized axes. I want the axes to be joined, but they get separated when I customize them with the axis() function.

Here's the code that generates the plot:

plot(smodelesp0,col=2,lwd=2,xlab="Tiempo en Días",ylab="Proporción de Frees",
main="Proporción de Usuarios Free pasados X días según Perfil",axes=F)
axis(1,at=seq(0,250,by=10),labels=seq(0,250,by=10),lwd=2)
axis(2,at=seq(0,1,by=0.1),labels=seq(0,1,by=0.1),lwd=2)
lines(smodelesp1,col=4,lwd=2)
legend("topright",c("Perfil de máximo riesgo","Perfil de mínimo riesgo"),col=c(2,4),lwd=2)

Here's the result: enter image description here

Any idea? Am I skipping some parameter in the axes function?

intael
  • 508
  • 2
  • 7
  • 21
  • 2
    You didn't supply any data so the plot and problem aren't [reproducible](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). You'll probably also want to specify `xlim=` and `ylim=` in the plot since `axis()` only controls where labels are printed, not the range of values plotted. – MrFlick Aug 21 '15 at 14:40
  • Suspect you are just wanting to do `box(bty="l")` after drawing the axes, in this case with `lwd=2` as well. – A. Webb Aug 21 '15 at 14:43

1 Answers1

2

Example from the help file of axis with a tweak

plot(1:4, rnorm(4), axes = FALSE)
axis(1, 1:4, LETTERS[1:4], lwd=2)
axis(2, lwd=2)

plot 1, mind the gap

Now join them with box

box(bty="l",lwd=2)

now with "L" shaped box

A. Webb
  • 26,227
  • 1
  • 63
  • 95