Create a figure window without navigation toolbar

Hi,

I know one can make a figure window without toolbar by doing

mpl.rcParams[‘toolbar’] = ‘None’

However, this approach is kind of annoying if one just wants to remove the toolbar for one figure window and to keep the default behavior to be with a toolbar. So, I am wondering if it is possible to do something like:

fig = figure(toolbar=False) # Create a new figure window with no toolbar.

If it is not possible now, I am wondering if the matplotlib team has any intention to implement that feature. I would think it is not hard to do so, since it is so easy to achieve that goal by setting a parameter. But I could very much be wrong, as I know nothing about how things work under the hood for matplotlib.

Anyway, I am mostly just curious, since I have already got a workaround for that. But it would be nice to know other’s people’s approaches/ideas. :slight_smile:

Thank you very much.

Jianbao

Actually, such a feature shouldn’t be too difficult to add. Why don’t you make a feature request for it on github and you might see it added for v1.3.

Cheers!
Ben Root

···

On Tue, Oct 2, 2012 at 11:09 PM, Jianbao Tao <jianbao.tao@…287…> wrote:

Hi,

I know one can make a figure window without toolbar by doing

mpl.rcParams[‘toolbar’] = ‘None’

However, this approach is kind of annoying if one just wants to remove the toolbar for one figure window and to keep the default behavior to be with a toolbar. So, I am wondering if it is possible to do something like:

fig = figure(toolbar=False) # Create a new figure window with no toolbar.

If it is not possible now, I am wondering if the matplotlib team has any intention to implement that feature. I would think it is not hard to do so, since it is so easy to achieve that goal by setting a parameter. But I could very much be wrong, as I know nothing about how things work under the hood for matplotlib.

Anyway, I am mostly just curious, since I have already got a workaround for that. But it would be nice to know other’s people’s approaches/ideas. :slight_smile:

Thank you very much.

Personally, I am not a fan of adding a window specific keyword to the
figure function (although there may be some there already).
With 1.2 you can use Matthew Emmett/Paul Ivanov's awesome new context
manager to remove the toolbar for the duration of the with statement:

import matplotlib.pyplot as plt
import matplotlib as mpl

with mpl.rc_context({'toolbar':False}):
    plt.plot(range(10))
    plt.show()

Does that make things easier/nicer for you?

Cheers,