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@…813…ourceforge.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.vanapalli@…2015…87…