擅长:python、mysql、java
<p>使用<code>autolim=False</code>参数可以忽略<code>LineCollection</code><a href="https://matplotlib.org/api/collections_api.html#matplotlib.collections.LineCollection" rel="nofollow noreferrer">objects</a>:</p>
<pre class="lang-py prettyprint-override"><code>from matplotlib.collections import LineCollection
fig, ax = plt.subplots()
x1 = np.linspace(-1,1,100)
# Will update limits
ax.plot(x1, np.sin(x1))
# Will not update limits
col = LineCollection([np.column_stack((x1, 3 * np.sin(x1)))], colors='g')
ax.add_collection(col, autolim=False)
# Will still update limits
ax.plot(x1, np.sin(x1 / 2.0))
</code></pre>
<p><img src="https://i.stack.imgur.com/eu8Jh.png" alt="See this image of the output"/></p>