2

When I try to break axis of a plot I always get an error. I use plotrix pkg.

My code so far:

xlim <- c(0,1)
ylim <- c(0,1)
gap.plot(evcent(USAN_g_num)$vector, betweenness(USAN_g_num, normalized=T), gap=c(0.4,0.6),gap.axis="y", xtics=c(0,0.3,0.7,1) ,xlim='xlim', ylim='ylim')

I get this error:

Error in rangexy[2] - rangexy[1] : 
  non-numeric argument to binary operator

Actually I think that I don't really need xlim and ylim. However I get an error that says me that xlim is missing if I don't use it.

Why I need a gap in Y-axis: My data ranges from 0 to 1 on both, x and y axis. On y axis I got an outlier. Therefore I have no datapoint between 0.4 and 0.6 on Y axis. Therefore I would like to cut this section out. What did I do wrong with my code? Thank for any help & sorry for this - maybe - beginner question.

SWR
  • 507
  • 1
  • 8
  • 17

2 Answers2

1

Unfortunately your code is not reproducible because you do not provide USAN_g_num.

But try:

xlim=xlim, ylim=ylim

in your call to gap.plot instead of xlim='xlim' and ylim='ylim'.

user1981275
  • 13,002
  • 8
  • 72
  • 101
0

Is there a reason that you are defining xlim and ylim outside of the call to gap.plot?

Otherwise, your error is due to passing a character string 'xlim' to the argument rather than a numerical range. Try the following, which will have the added benefit of shortening your code and not storing xlim and ylim as global variables:

gap.plot(evcent(USAN_g_num)$vector, betweenness(USAN_g_num, normalized=T), gap=c(0.4,0.6),gap.axis="y", xtics=c(0,0.3,0.7,1) ,xlim=c(0,1), ylim=c(0,1)

M Myer
  • 11
  • 3