schrodinger.application.bioluminate.sliderchart module

Tools for using matplotlib charts.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.application.bioluminate.sliderchart.prevent_overlapping_x_labels(canvas, axes_number=0)

Given a canvas that contains a figure that contains at least one axes instance, checks the x-axis tick labels to make sure they don’t overlap. If they do, the number of ticks is reduced until there is no overlap.

Parameters:
  • canvas (matplotlib canvas object) – the canvas that contains the figure/axes objects
  • axes_number (int) – the index of the axes on the figure to examine. Default is 0, which is the first set of axis added to the figure.
class schrodinger.application.bioluminate.sliderchart.SliderPlot(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, use_hsliders=True, xstart=0.2, xextent=None)

Bases: PyQt5.QtWidgets.QFrame

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

replot()

Replot the chart with the current settings

removeColorsForMissingPoints()

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(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()

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

Return type:tuple
Returns: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(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(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(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()

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

Return type:float or -INF
Returns:The current value of the minimum horizontal slider, if in use
getHSliderMax()

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

Return type:float or INF
Returns:The current value of the maximum horizontal slider, if in use
getVSliderMin()

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

Return type:float
Returns:The current value of the minimum vertical slider
getVSliderMax()

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

Return type:float
Returns:The current value of the maximum vertical slider
getSelectedIndexes()

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

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

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

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

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

Return type:list
Returns:x values of data points that are within the box bounded by the slider lines
class schrodinger.application.bioluminate.sliderchart.SlidableLine(parent, axes, line, tolerance=7, border='high', shade_color='0.70', callback=None)

Bases: object

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

onRelease(event)

Stop checking for movement when the mouse button is released

remove()

Remove this from the plot

class schrodinger.application.bioluminate.sliderchart.SlidableHLine(*args, **kwargs)

Bases: schrodinger.application.bioluminate.sliderchart.SlidableLine

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

getPosition()

Return the position of the line in data coordinates

Return type:float
Returns:The current position of the line in data coordinates
getAxisExtreme()

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

Return type:float
Returns:The most extreme value this line can take in data coordinates
setPosition(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 y value to attempt to place the line at
onMotion(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(event)

Check to see if the user clicked this line

Parameters:event (matplotlib mouse event) – the event object generated by mouse click
class schrodinger.application.bioluminate.sliderchart.SlidableVLine(*args, **kwargs)

Bases: schrodinger.application.bioluminate.sliderchart.SlidableLine

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

getPosition()

Return the position of the line in data coordinates

Return type:float
Returns:The current position of the line in data coordinates
setPosition(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()

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

Return type:float
Returns:The most extreme value this line can take in data coordinates
onMotion(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(event)

Check to see if the user clicked this line

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