Point and line tooltips in matplotlib?

For points, I have found a way, but you have to use the WX backend.

For points, I have found a way, but you have to use the WX backend """Example of how to use wx tooltips on a matplotlib figure window. Adapted from osdir.com/ml/python.matplotlib.devel/200... import matplotlib as mpl mpl. Use('WXAgg') mpl.

Interactive(False) import pylab as pl from pylab import get_current_fig_manager as gcfm import wx import numpy as np import random class wxToolTipExample(object): def __init__(self): self. Figure = pl.figure() self. Axis = self.figure.

Add_subplot(111) # create a long tooltip with newline to get around wx bug (in v2.6.3.3) # where newlines aren't recognized on subsequent self.tooltip.SetTip() calls self. Tooltip = wx. ToolTip(tip='tip with a long %s line and a newline\n' % (' '*100)) gcfm().canvas.

SetToolTip(self. Tooltip) self.tooltip. Enable(False) self.tooltip.

SetDelay(0) self.figure.canvas. Mpl_connect('motion_notify_event', self. _onMotion) self.

DataX = np. Arange(0, 100) self. DataY = random.random()*100.0 for x in xrange(len(self.

DataX)) self.axis. Plot(self. DataX, self.

DataY, linestyle='-', marker='o', markersize=10, label='myplot') def _onMotion(self, event): collisionFound = False if event. Xdata! = None and event.

Ydata! = None: # mouse is inside the axes for I in xrange(len(self. DataX)): radius = 1 if abs(event.

Xdata - self. DataXi) DataYi) SetTip(tip) self.tooltip. Enable(True) collisionFound = True break if not collisionFound: self.tooltip.

Enable(False) example = wxToolTipExample() pl.show().

At least it isn't restricted to wx backend.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions