0

Consider the following code:

import matplotlib.pyplot as plt
import numpy as np
import pickle

x = np.arange(0, 5, 0.1)
y = np.sin(x)
f = plt.figure(figsize=(32, 24))
#f = plt.figure(figsize=(8, 6))
plt.plot(x, y)
plt.show(block=False)

If I initialize figure with figsize=(8, 6) it shows navigation bar normally

enter image description here

But if I initialize it with figsize=(32, 24) it doesn't show navigation bar, even if I resize figure window to small size

enter image description here

Why and how to fix? Is it possible to force navigation bar to appear programmatically?


If I do

f.canvas.toolbar.setVisible(True)

I get

AttributeError: 'NavigationToolbar2TkAgg' object has no attribute 'setVisible'

and if I do

f.canvas.toolbar.pack_forget()

I have no errors but also have no navigation bar.

How to restore navigation bar on Tk or portable?

Dims
  • 47,675
  • 117
  • 331
  • 600

0 Answers0