Quantcast

How to modify the navigation toolbar easily in a matplotlib figure window?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to modify the navigation toolbar easily in a matplotlib figure window?

Jianbao Tao

Is it possible to do something like the following to modify the navigation toolbar in matplotlib?

  1. Generate a figure window, such as by *fig = figure()*
  2. Get a reference of the navigation toolbar, such as by *tbar = fig.get_navigation_toolbar()* or better yet, just by *tbar = fig.navtbar*
  3. Modify the toolbar through the reference tbar, such as delete/add/edit a button by something like this: *tbar.add_button()*,  *tbar.remove_button(a reference to a button)*,  *tbar.edit_button(a reference to a button)*.
  4. Update the figure by *fig.canvas.draw()*
Thank you very much.

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to modify the navigation toolbar easily in a matplotlib figure window?

Eric Firing
On 2012/10/02 8:08 AM, Jianbao Tao wrote:

> Is it possible to do something like the following to modify the
> navigation toolbar in matplotlib?
>
>  1. Generate a figure window, such as by *fig = figure()*
>  2. Get a reference of the navigation toolbar, such as by *tbar =
>     fig.get_navigation_toolbar()* or better yet, just by *tbar =
>     fig.navtbar*
>  3. Modify the toolbar through the reference /tbar/, such as
>     delete/add/edit a button by something like this:
>     *tbar.add_button()*,  *tbar.remove_button(a reference to a button)*,
>       *tbar.edit_button(a reference to a button)*.
>  4. Update the figure by *fig.canvas.draw()*

No, this sort of flexibility has been at least on the mental wish-list
for a long time, but it is not available.  It would require substantial
work on all of the gui backends.

Eric

>
> Thank you very much.
>
>
> ------------------------------------------------------------------------------
> Don't let slow site performance ruin your business. Deploy New Relic APM
> Deploy New Relic app performance management and know exactly
> what is happening inside your Ruby, Python, PHP, Java, and .NET app
> Try New Relic at no cost today and get our sweet Data Nerd shirt too!
> http://p.sf.net/sfu/newrelic-dev2dev
>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>


------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to modify the navigation toolbar easily in a matplotlib figure window?

Benjamin Root-2


On Tue, Oct 2, 2012 at 2:34 PM, Eric Firing <[hidden email]> wrote:
On 2012/10/02 8:08 AM, Jianbao Tao wrote:
> Is it possible to do something like the following to modify the
> navigation toolbar in matplotlib?
>
>  1. Generate a figure window, such as by *fig = figure()*
>  2. Get a reference of the navigation toolbar, such as by *tbar =
>     fig.get_navigation_toolbar()* or better yet, just by *tbar =
>     fig.navtbar*
>  3. Modify the toolbar through the reference /tbar/, such as
>     delete/add/edit a button by something like this:
>     *tbar.add_button()*,  *tbar.remove_button(a reference to a button)*,
>       *tbar.edit_button(a reference to a button)*.
>  4. Update the figure by *fig.canvas.draw()*

No, this sort of flexibility has been at least on the mental wish-list
for a long time, but it is not available.  It would require substantial
work on all of the gui backends.

Eric


Note, however, code has been improved for the 1.2.0 release to make it easier to modify the set of buttons that are used.  In backend_bases.py, look for the NavigationToolbar2 class.

Cheers!
Ben Root


------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to modify the navigation toolbar easily in a matplotlib figure window?

Phil Elson-2
> Note, however, code has been improved for the 1.2.0 release to make it easier to modify the set of buttons that are used.  In backend_bases.py, look for the NavigationToolbar2 class.

Ah yes! I knew I did that for a good reason. :-) Good thinking Ben!

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Matplotlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Loading...