What is the official name of this title bar from matplotlib and how do I hide it?

前端 未结 2 1967
名媛妹妹
名媛妹妹 2021-01-27 16:20

I am new to matplotlib, and I don\'t know what the name of the title bar arrowed in following image is.

Title bar

I googled and dug from matplotlib official docu

相关标签:
2条回答
  • 2021-01-27 16:51

    The title bar of the figure may be called dialog-titlebar judging from its name in the layout. It is a <div> element of the output's DOM tree. To hide such elements, they may be given the display: none; property via CSS. Somewhere in your notebook you may state

    %%html
    <style>
    div.ui-dialog-titlebar {display: none;}
    </style>
    

    See How do I set custom CSS for my IPython/IHaskell/Jupyter Notebook? for how to apply this potentially to any notebook by default.

    An alternative is to not use the %matplotlib notebook backend, but %matplotlib widget instead. This is part of jupyter-matplotlib and currently needs to be installed separately as shown in the link. It'll by default have no titlebar while still providing full interactivity. There is a looong term plan to have it replace the %matplotlib notebook backend - but "looong" has many "o"s here.

    0 讨论(0)
  • 2021-01-27 17:16

    What you refer to as "title bar", is actually part of the notebook backend - essentially the code that translates what you write in python to something that can be visualised as a figure. The notebook backend is made to be interactive within Jupyter notebooks, and as such has that bar, plus buttons you can use to pan, zoom, etc. When you save the figure via plt.savefig() or by clicking the save button, the bar will not appear.

    If you want to get rid of the interactivity all together, try using the %matplotlib inline magic instead - that will select the inline backend, and remove the interactivity.

    0 讨论(0)
提交回复
热议问题