hist() error: 'breaks' do not span range of 'data' and barplot(, log = "y") error: 'height + offset <= 0
<p>In the x axis, I have a large amount of data (0:700) 
When I use this :</p>

<pre><code>dh &lt;- hist(data)
barplot(dh$counts, log="y", col="white", names.arg=dh$breaks[-1])
</code></pre>

<p>I get this graphic: </p>

<p><a href="https://i.stack.imgur.com/juVWW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/juVWW.png" alt="enter image description here"></a></p>

<p>But I want to get smaller values of breaks.
I tried to modify the breaks value but I get an error</p>

<blockquote>
  <p>Error in hist.default(data, breaks = seq(5, 700, by = 10)) : some 'data' not counted; maybe 'breaks' do not span range of 'data'</p>
</blockquote>

<hr>

<p><strong>follow up:</strong></p>

<p>After setting <code>breaks = seq(0, 700, by = 10)</code> as the answer suggests, <code>hist()</code> works fine but <code>barplot()</code> gives me error:</p>

<blockquote>
  <p>error log axis: at least one value 'height + offset &lt;= 0</p>
</blockquote>

<p>What happened?</p>