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

Class SliderPlot

PyQt4.QtGui.QFrame --+
                     |
                    SliderPlot

A chart that contains four lines the user can slide to select a region of the chart.

Instance Methods [hide private]
QFrame
__init__(self, xvals=None, yvals=None, size=(400,400), x_label='Residue Sequence', y_label='Values', x_range=None, y_range=None, color='black', cvals=None, bg='white', title='Results', fontsize='small', chart_type='line', marker='square', marker_size=9, shade_color='0.70', hslider_color='red', vslider_color='blue', slider_thickness=3, slider_pick_tolerance=7, slider_moved_callback=None)
Create a SliderPlot instance.
 
replot(self)
Replot the chart with the current settings
 
removeColorsForMissingPoints(self)
Remove any colors for points that are missing X or Y data (X or Y = None) from the list of original values.
 
setCVals(self, cvals)
Set the color values for scatterplot points and replot
tuple
removeMissingPoints(self)
Remove any points that are missing X or Y data (X or Y = None) from the list of original values
 
setXY(self, xvals, yvals, x_range=None, y_range=None, replot=True)
Change the X and Y values of the plot
 
setX(self, xvals, x_range=None, replot=True, reset_yrange=False)
Change the X values of the plot
 
setY(self, yvals, y_range=None, replot=True, reset_xrange=False)
Change the Y values of the plot
float
getHSliderMin(self)
Get the current value of the minimum horizontal slider line in plot data units
float
getHSliderMax(self)
Get the current value of the maximum horizontal slider line in plot data units
float
getVSliderMin(self)
Get the current value of the minimum vertical slider line in plot data units
float
getVSliderMax(self)
Get the current value of the maximum vertical slider line in plot data units
list
getSelectedIndexes(self)
Get the index in the x-value list of points that are contained within the slider lines.
list
getSelectedXY(self)
Get the set of (x, y) points that are contained within the slider lines
list
getSelectedX(self)
Get the set of x values for all points that are contained within the slider lines.
Method Details [hide private]

__init__(self, xvals=None, yvals=None, size=(400,400), x_label='Residue Sequence', y_label='Values', x_range=None, y_range=None, color='black', cvals=None, bg='white', title='Results', fontsize='small', chart_type='line', marker='square', marker_size=9, shade_color='0.70', hslider_color='red', vslider_color='blue', slider_thickness=3, slider_pick_tolerance=7, slider_moved_callback=None)
(Constructor)

 

Create a SliderPlot instance.

The plot is returned in a QFrame widget.

Parameters:
  • xvals (list) - the x values to plot
  • yvals (list) - y series to plot, should be the same length as xvals
  • size (tuple) - (x, y) plot size in pixels
  • x_label (str) - X-axis label
  • y_label (str) - Y-axis label
  • x_range (tuple) - (min, max) values for the X-axis, default is to show all values
  • y_range (tuple) - (min, max) values for the Y-axis, default is to show all values
  • color (str) - color for the line plot - this is overridden by cvals if cvals is given.
  • cvals (list, tuple or str) - For scatterplots, either a list or tuple of color values for every point, or a string to set a single color for all points. Do not use an RGB list or tuple to set a single color for all points, as that will be interpreted as intended to set individual colors for 3 (or 4 for RGBA) points. This overrides the value of color, and is not used for line plots, only scatter plots. If not given, the value of color is used.
  • bg (str) - color name for the plot background. See marker:color for some color names.
  • title (str) - the title of the plot
  • chart_type (str) - 'line' if the chart is a line plot (default), 'scatter' if the chart is scatterplot
  • shade_color (str) - A matplotlib-recognized color string that the unselected areas will be shaded
  • hslider_color (str) - A matplotlib-recognized color string that the horizontal sliders will be colored
  • vslider_color (str) - A matplotlib-recognized color string that the vertical sliders will be colored
  • slider_thickness (int) - Linewidth of the slider lines
  • slider_pick_tolerance (int) - Number of pixels the mouse click can be off and still grab the slider
  • slider_moved_callback (callable) - Called when one of the slider lines has been moved. The callback will receive the SlidableLine object that was moved.
  • marker (tuple) - tuple of (symbol, color, size), only used for scatter plots
    • symbol (1-character str)
      • s - square ('square', rectangle accepted)
      • o - circle ('circle' accepted)
      • ^ - triangle up ('arrow' accepted)
      • > - triangle right
      • < - triangle left
      • v - triangle down
      • d - diamond ('diamond' accepted)
      • p - pentagon
      • h - hexagon
      • 8 - octagon
      • + - plus ('cross' accepted)
      • x - x
  • marker_size (int) - size of the marker
  • fontsize (int or str) - size in points, or one of the following -
    • xx-small
    • x-small
    • small
    • medium
    • large
    • x-large
    • xx-large
Returns: QFrame
The QFrame widget that contains the plot

removeColorsForMissingPoints(self)

 

Remove any colors for points that are missing X or Y data (X or Y = None) from the list of original values. Does nothing if the point colors are not a list or tuple.

setCVals(self, cvals)

 

Set the color values for scatterplot points and replot

Parameters:
  • cvals (list, tuple or str) - Either a list or tuple of color values for every point, or a string to set a single color for all points. Do not use an RGB list or tuple to set a single color for all points, as that will be interpreted as intended to set individual colors for 3 (or 4 for RGBA) points.

removeMissingPoints(self)

 

Remove any points that are missing X or Y data (X or Y = None) from the list of original values

Returns: tuple
tuple of (x-values, y-values) where each item is a list of values. Any point for which x-value or y-value is None has been removed.

setXY(self, xvals, yvals, x_range=None, y_range=None, replot=True)

 

Change the X and Y values of the plot

Parameters:
  • xvals (list) - the x values to plot
  • yvals (list) - y series to plot, should be the same length as xvals
  • x_range (tuple) - (min, max) values for the X-axis, default is to show all values
  • y_range (tuple) - (min, max) values for the Y-axis, default is to show all values
  • replot (bool) - True of plot should be redrawn (default), False if not. False can be used if a subsequent setY is required.

setX(self, xvals, x_range=None, replot=True, reset_yrange=False)

 

Change the X values of the plot

Parameters:
  • xvals (list) - the x values to plot
  • x_range (tuple) - (min, max) values for the X-axis, default is to show all values
  • replot (bool) - True of plot should be redrawn (default), False if not. False can be used if a subsequent setY is required.
  • reset_yrange (bool) - True if the y_range should be reset, False (default) if not. It is useful to reset this if the number of datapoints is changing.

setY(self, yvals, y_range=None, replot=True, reset_xrange=False)

 

Change the Y values of the plot

Parameters:
  • yvals (list) - the y values to plot
  • y_range (tuple) - (min, max) values for the Y-axis, default is to show all values
  • replot (bool) - True of plot should be redrawn (default), False if not. False can be used if a subsequent setY is required.
  • reset_xrange (bool) - True if the y_range should be reset, False (default) if not. It is useful to reset this if the number of datapoints is changing.

getHSliderMin(self)

 

Get the current value of the minimum horizontal slider line in plot data units

Returns: float
The current value of the minimum horizontal slider

getHSliderMax(self)

 

Get the current value of the maximum horizontal slider line in plot data units

Returns: float
The current value of the maximum horizontal slider

getVSliderMin(self)

 

Get the current value of the minimum vertical slider line in plot data units

Returns: float
The current value of the minimum vertical slider

getVSliderMax(self)

 

Get the current value of the maximum vertical slider line in plot data units

Returns: float
The current value of the maximum vertical slider

getSelectedIndexes(self)

 

Get the index in the x-value list of points that are contained within the slider lines.

Returns: list
index in the x-value list of points that are within the box bounded by the slider lines.

getSelectedXY(self)

 

Get the set of (x, y) points that are contained within the slider lines

Returns: list
(x, y) data points that are within the box bounded by the slider lines

getSelectedX(self)

 

Get the set of x values for all points that are contained within the slider lines.

Returns: list
x values of data points that are within the box bounded by the slider lines