擅长:python、mysql、java
<p>要回答您预期的问题,请不要调用<code>set_xdata</code>尝试类似<code>update_from</code>的方法。我不保证这会奏效,但我会努力的</p>
<pre><code>def update(self, xData, yData):
# update your data structures
self.xData = np.append(self.xData, xData)
self.yData = np.append(self.yData, yData)
# create a new hexbin - not connected to anything, with the new data
new_hexbin = self.ax.hexbin(self.xData, self.yData)
# update the viewed hexbin from the new one
self.graph.update_from(new_hexbin)
self.figure.canvas.draw()
</code></pre>
<p>请注意,没有更多的代码或解释,这真的只是猜测工作!这个类的文档是<a href="http://matplotlib.org/api/collections_api.html?highlight=polycollection#matplotlib.collections.PolyCollection" rel="nofollow">here</a>,<a href="http://matplotlib.org/api/collections_api.html?highlight=polycollection#matplotlib.collections.Collection.update_from" rel="nofollow">^{<cd2>}</a>方法来自<a href="http://matplotlib.org/api/collections_api.html?highlight=polycollection#matplotlib.collections.Collection" rel="nofollow">parent class</a>。在</p>