title: Skip value zero from the series while doing graph using plot in R
body: <p><img src="https://i.stack.imgur.com/XZ9yL.jpg" alt="enter image description here">I'm having a function to plot a graph. I'm having value zero, it is similar to NA. I dont want to include that in calculating mean. Also I dont want to include in the graph. Instead of zero value we can give some space. Please advise.</p>
  
  <pre><code>    x &lt;- c(579, 0, 581, 610, 830, 828, 592, 651, 596, 596, 591, 581, 587, 594, 604, 606, 447, 434, 445)
      drawGraph &lt;- function(x, y, z) {
      g_range &lt;- range(0,x)
      #is.na(x) &lt;- (x == 0)
      plot(x, type="o", col="blue", ylim=g_range,axes=FALSE, ann=FALSE)
      box()
      axis(1, at=1:length(x), lab=FALSE)
      text(1:length(x), par("usr")[3] - 2, srt=45, adj=1.2, labels=y, xpd=T, cex=0.3)
      scale=round(max(x)/10,digits=0)
      axis(2, las=1, at=scale*0:g_range[2], cex.axis=0.3)
      main_title&lt;-as.expression(z)
      MEANLIMIT &lt;- seq(length=length(x), from=mean(x), by=0)
      ULIMIT &lt;- seq(length=length(x), from=(mean(x)*2.66), by=0)
      LLIMIT &lt;- seq(length=length(x), from=(mean(x)/2.66), by=0)
      lines(MEANLIMIT, type="l", pch=2, lty=2, col="grey")
      lines(ULIMIT, type="l", pch=2, lty=2, col="red")
      lines(LLIMIT, type="l", pch=2, lty=2, col="grey")
      title(main=main_title, col.main="red", font.main=4)
      title(xlab="Build", col.lab=rgb(0,0.5,0))
      title(ylab="MS", col.lab=rgb(0,0.5,0))
      legend("topright", g_range[2], main_title, cex=0.8, col=c("blue"), pch=21, lty=1);
      }
  </code></pre>