Closed
Description
The following does not work on Mac OSX:
from __future__ import division
import threading
import time
import sys
import numpy as np
import matplotlib
matplotlib.use('MacOSX')
import matplotlib.pyplot as plt
class async_worker(threading.Thread):
def __init__(self, fig, axis):
threading.Thread.__init__(self)
self.fig = fig
self.axis = axis
def run(self):
i = 0
while True:
print "Run thread %d" % i
sys.stdout.flush()
i += 1
time.sleep(0.1)
def main():
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.plot(np.random.rand(251, 1))
async_worker(fig, ax).start()
plt.show()
if __name__ == "__main__":
main()
I expect to see "Run thread" repeated every 0.1 seconds, no matter if I interact with the plot or not. Instead I only see it repeat when I click and drag around in the MPL figure.
When switching to matplotlib.use('TkAgg')
, the second thread runs as expected.
Metadata
Metadata
Assignees
Labels
No labels