I have the following vector x
with each corresponding index vector.
x = c(0,-50,-65,0,0,-58,0)
index = c(1,2,3,4,5,6,7)
and when I plot them (index,x) I take the following
plot(index,x)
However, is there a way to display a plot that has the same indexing i.e. the same (index,x) order, but doesn't display the points with x=0
.
I don't want to plot these points in order for my plot to "focus-zoom" on the negative values.
Is there a way to that in R?
CodePudding user response:
Update:
We could assign NA
to 0
:
is.na(x) <- x== 0
x
plot(index,x)
First answer: Are you looking for such a solution?
plot(index,x, ylim=c(min(x), -10))