On Thu, Jul 7, 2011 at 11:59 AM, Ravi Kanth Vanapalli <
vvnrk.vanapa...@gmail.com> wrote:
> Hi all,
>
> I need some help creating tooltips using pyplot figure rather than the
> exisiting pylab example as in the link below
>
> http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg00954.html
> Well there is a specific reason for this. I am trying to write an
> application which needs to call show() twice. matplotlib 1.0.1 solves this
> issue by using show() in pyplot.
>
> The code snippet i've used is
>
> from pylab import *
> import scipy
> from wxPython.wx import *
> import wx
> import matplotlib.pyplot as plt
> application = wxPySimpleApp()
> tooltip = wx.ToolTip(tip='tip with a long %s line and a newline\n' % ('
> '*100))
> fig=plt.figure()
> ax=plt.gca()
> x=arange(10)
> y=x*2
> plt.plot(x,y)
> plt.xlim(-2,15)
> plt.show()
> print 'passed the first show'
> x=arange(10)
> y=sin(x)
> plt.xlim(-5,10)
> plt.plot(x,y)
> #print plt.get_current_fig_manager().canvas.SetToolTip(tooltip)
> plt.show()
> print 'passed the second show'
>
> As per my observation, we need not create a new figure everytime we use
> pyplot. Just plt.show() serves the purpose.
> In case of using pylab show() then we need to call it once at the end of
> the program or create a new figure everytime previous figure is closed and
> it works too.
> *Please correct me if my observation is wrong.*
>
> I am stuck at the point at tooltips now. How should I create tooltips on a
> figure plotted using pyplot.
>
> My program says there "*FigureCanvasTkAgg instance has no attribute
> 'SetToolTip'*"
> plt.get_current_fig_manager().canvas.SetToolTip(tooltip)
>
> for the current figure manager but in pylab equivalent
> *from pylab import get_current_fig_manager as gcfm*
> *gcfm().canvas.SetToolTip(tooltip) *
> works.
>
> Please guide me how to go about this issue.
>
> --
> Regards,
>
> RaviKanth VN Vanapalli
> MS - Telecommunications Engineering
> The University of Texas at Dallas, Richardson, TX
> Ph: (571) 420 0656
> Email: vvnrk.vanapa...@gmail.com
>
>
Just a quick comment, according to your error message, you have a TkAgg
figure, not a WxAgg figure. Maybe you should try forcing a particular
backend using "matplotlib.use('WxAgg')" at the beginning of the program?
I haven't read through the rest to comment on the validity of your
observations about show().
Ben Root
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users