2

I use the widget backend to embed an interactive matplotlib figure in an ipywidgets.GridBox. The window title takes up too much space and I want to remove it. With plt.figure(' ') it becomes invisible but even with fig.tight_layout() the space is still reserved and takes up useless space in my layout. Below is a minimal example.

import matplotlib.pyplot as plt
%matplotlib widget
plt.ioff()
fig = plt.figure('remove the title')
plt.plot([0,1],[0,1])
fig.tight_layout()
display(fig.canvas)

I found a few examples here but no complete list of backend specific options. In this related post a solution for the notebook backend is given. what is the official name of this title bar from matplotlib, how to hide it

ebrahimi
  • 912
  • 2
  • 13
  • 32
dukeeloo
  • 161
  • 7

1 Answers1

2

My answer is a little late but maybe someone else is interested, too. For this special backend the title can be made invisible by

%%html
<style>
div.jupyter-widgets.widget-label {display: none;}
</style>
JoergVanAken
  • 1,286
  • 9
  • 10
  • Thank you! I was not able to solve it in the meantime so it is still useful – dukeeloo Feb 02 '20 at 10:33
  • I am very pleased about that. If this solves your problem don't forget to accept the answer. – JoergVanAken Feb 03 '20 at 07:59
  • I realized that this not only removes the title but also the x and y coordinates of the cursor which are shown below the figure. is there a way to keep them? – dukeeloo Mar 25 '20 at 12:39