简体   繁体   中英

Removing tool bar and figure title when using jupyter-matplotlib

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.

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

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM