Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0005ab4 commit 75ba03dCopy full SHA for 75ba03d
1 file changed
examples/pylab_examples/agg_buffer_to_array.py
@@ -12,7 +12,9 @@
12
# grab the pixel buffer and dump it into a numpy array
13
buf = fig.canvas.buffer_rgba()
14
l, b, w, h = fig.bbox.bounds
15
-X = np.fromstring(buf, np.uint8)
+# The array needs to be copied, because the underlying buffer
16
+# may be reallocated when the window is resized.
17
+X = np.frombuffer(buf, np.uint8).copy()
18
X.shape = h,w,4
19
20
# now display the array X as an Axes in a new figure
0 commit comments