Package schrodinger :: Package application :: Package bioluminate :: Module sliderchart :: Class SlidableVLine
[hide private]
[frames] | no frames]

Class SlidableVLine

  object --+    
           |    
SlidableLine --+
               |
              SlidableVLine

A vertical line on a matplotlib plot that can be grabbed and moved by the user

Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
Create a SlidableVLine object
float
getPosition(self)
Return the position of the line in data coordinates
 
setPosition(self, value)
Change the position of the line to value.
float
getAxisExtreme(self)
Return the most extreme (high or low) value this line should take
 
onMotion(self, event)
Move the line if it is currently moving and the mouse moved
 
onPress(self, event)
Check to see if the user clicked this line

Inherited from SlidableLine: onRelease, remove

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args, **kwargs)
(Constructor)

 

Create a SlidableVLine object

See parent class for argument documentation

Parameters:
  • parent - The matplotlib canvas these lines are plotted on
  • axes - The matplotlib axes these lines are plotted on
  • line - the actual line that will be moved
  • tolerance - The amount that the user can "miss" the line and still grab it
  • border - either "high" or "low", the role this line plays in bounding the box - high lines are those that bound the upper value of X or Y
  • shade_color - A matplotlib-recognized color string that the unselected areas will be shaded
  • callback - Called when the slider line has been moved. The callback will receive the SlidableLine object that was moved.
Overrides: object.__init__

getPosition(self)

 

Return the position of the line in data coordinates

Returns: float
The current position of the line in data coordinates

setPosition(self, value)

 

Change the position of the line to value. However, we don't allow the high/low boundary lines to cross, or to go off the plot.

Parameters:
  • value (float) - The new x value to attempt to place the line at

getAxisExtreme(self)

 

Return the most extreme (high or low) value this line should take

Returns: float
The most extreme value this line can take in data coordinates

onMotion(self, event)

 

Move the line if it is currently moving and the mouse moved

Parameters:
  • event (matplotlib mouse event) - the event object generated by mouse movement

onPress(self, event)

 

Check to see if the user clicked this line

Parameters:
  • event (matplotlib mouse event) - the event object generated by mouse click