Scatter - Trident Chemwidgets - Docs v0.1

Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# Scatter

class trident_chemwidgets.Scatter(**kwargs)

  Bases: `ipywidgets.widgets.domwidget.DOMWidget`

  Plot an interactive scatter plot based on the given data and the selected variables to generate the axis.

  The scatter plot will be displayed to the left of the cell output, with a molecule gallery displayed to the right. The molecule gallery can show the structures present in the currently-selected subset of the data.

  Parameters

    - data (pd.DataFrame) – Data used to generate the scatter plot.

    - smiles (str) – Name of the column that contains the SMILES string of each molecule.

    - x (str) – Name of the column used to generate the x-axis of the scatter plot.

    - y (str) – Name of the column used to generate the y-axis of the scatter plot.

    - x_label (str) – Label for the x-axis of the histogram, defaults to the value of x if not provided.

    - y_label (str) – Label for the y-axis of the histogram, defaults to the value of y if not provided.

  Examples

      >>> import trident_chemwidgets as tcw
      >>> import pandas as pd
      >>> dataset = pd.read_csv(PATH)
      >>> scatter = tcw.Scatter(data=dataset, smiles='smiles', x='mwt', y='logp')
      >>> scatter

  property selection

    Current selection of molecules made by the user.

## Interaction features

### Selecting data

Once the widget renders, click and drag within the plot area to select a subset of the data. The selected data points will change color to teal and have a dark blue outline.

### Displaying selected structures

Once a subset of the data has been selected, you can then press the `SHOW STRUCTURES` button to display a gallery of the selected structures in the space to the right of the plot.

### Saving selected subset to `selection` property

You can save the current selection of data by clicking `SAVE SELECTION`. This action will make current subset of the data available using the `selection` property of the widget. To clear the current selection, click anywhere in the plot area. Note that if you clicked `SAVE SELECTION`, the reference to those data points will be saved until it is overwritten by the `SAVE SELECTION` button being clicked for a new selection.

## Example

See Using the Scatter widget.