2

I'm using jupyter-matplotlib to embed charts as widgets in a jupyter widgets based dashboard. However, I would like to disable the interactive tool bar and the figure title that automatically gets added.

As a simple example, the below creates an empty figure but it still has the interactive tool bar and Figure title.

%matplotlib widget

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

I would like to remove both the tool bar and figure title as well as anything else that is added padding around the plot, which I may not be able to see.

Chris
  • 1,313
  • 2
  • 13
  • 26
  • 1
    It looks like the ability to remove the title is a feature that is coming, see https://github.com/matplotlib/jupyter-matplotlib/issues/134 – Chris Jan 07 '20 at 22:21

2 Answers2

9

If you are using the latest jupyter-matplotlib version (0.5.3 as I am writting), you can use:

fig.canvas.toolbar_visible = False
fig.canvas.header_visible = False
fig.canvas.footer_visible = False

You can also disable the resizing:

fig.canvas.resizable = False
Martin Renou
  • 424
  • 2
  • 10
2

To get rid of toolbar you can use this

mpl.rcParams['toolbar'] = 'None'

To remove title you can set the title to me empty something like this

fig.set_title("")

Hope this helps!

zenwraight
  • 2,002
  • 1
  • 10
  • 14
  • 1
    Thanks for the quick reply. Unfortunately jupyter-matplotlib doesn't seem to follow the standard conventions. I did figure out that fig.canvas.toolbar_visible = False can be used to turnoff the toolbar; I'm still working on the title. – Chris Jan 07 '20 at 22:15
  • 1
    `axes.get_figure().set_title("")` gets me `AttributeError: 'Figure' object has no attribute 'set_title'` – henrique Oct 02 '21 at 13:24