Score:0

Matplotlib plt.show(block=False) opens black window

tc flag

Matplotlib plt.show(block=False) gives me a black window when plotting something that normally works with plt.show(block=True). With my previous Ubuntu install I could always run plt.show(block=False) without any issues.

Here is a simple piece of code that gives me the black screen:

    y = np.random.random(10)
    x = np.linspace(1, len(y), len(y))
    plt.plot(x, y)
    plt.show(block=False)
    time.sleep(5)

The graph shows properly when I use block=True, but gives a black window in the code above. This happens in both python3 and IPython.

Extra information:

  • Fresh install of Ubuntu 20.04.4
  • Python 3.8.10
  • matplotlib version 3.5.1
  • tested with backends: [QtAag, Qt5Aag, TkAgg], with same results

Any help would be much appreciated, I mostly use the block=False argument to view/analyze the data whilst zooming-in etc. on the graph.

With kind regards,

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.