Skip to main content
In Edit Mode, outputs like dataframes and figures are rendered automatically. In App Mode, no outputs are shown unless explicitly defined. Output widgets allow you to specify which elements should be visible, providing fine-grained control over the app interface.

Supported Output Widget Types

Below is a comprehensive list of supported output widget types.
The Plot output widget allows you to display matplotlib Figures, SubFigures, Axes, or Plotly figures in your notebook interface.
import matplotlib.pyplot as plt
from lplots.widgets.plot import w_plot

# Create a matplotlib figure
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 2, 3])
ax.set_title("My Plot")

# Display the plot in the notebook
plot = w_plot(
    label="Example Plot", # optional label displayed above the plot
    source=fig
)

Widget Parameters

label: string optional label displayed above the plotsource: Figure | SubFigure | Axes | BaseFigure the plot object to display. Can be:
  • Matplotlib Figure
  • Matplotlib SubFigure
  • Matplotlib Axes
  • Plotly Figure (BaseFigure)
key: string optional unique identifier for the widget

Usage Notes

  • The plot widget automatically detects the plot title from the source object
  • The widget creates an interactive display of your plot that users can interact with
  • In the notebook outline, the plot title from the source object will be used if no label is provided

Examples

Matplotlib Axes Example:
import matplotlib.pyplot as plt
from lplots.widgets.plot import w_plot

# Create plot with axes
fig, ax = plt.subplots()
ax.scatter([1,2,3], [1,2,3])
ax.set_title("Scatter Plot")

# Display just the axes
w_plot(source=ax)
Plotly Figure Example:
import plotly.express as px
from lplots.widgets.plot import w_plot

# Create a plotly figure
fig = px.scatter(x=[1,2,3], y=[1,2,3])
fig.update_layout(title="Plotly Scatter")

# Display the plotly figure
w_plot(label="Interactive Plot", source=fig)
The Table output widget allows you to display tabular data in an interactive table format.
import pandas as pd
from lplots.widgets.table import w_table

# Create sample dataframe
df = pd.DataFrame({
    'A': [1, 2, 3],
    'B': ['a', 'b', 'c']
})

# Display the table
table = w_table(
    label="Sample Data",
    source=df
)

Widget Parameters

label: string optional label displayed above the tablesource: DataFrame the pandas DataFrame to displaykey: string optional unique identifier for the widget
The IGV output widget allows you to visualize and interact with your genomic data.
from lplots.widgets.igv import w_igv, IGVOptions

latch_path = f"latch://<workspace_id>.account/Covid/covid.bam"
index_path = f"latch://<workspace_id>.account/Covid/covid.bam.bai"

options: IGVOptions = {
  "genome": "hg38",
  "tracks": [
    {
      "name": "test",
      "type": "alignment",
      "url": latch_path,
      "indexURL": index_path,
      "minHeight": 100,
      "maxHeight": 200
    }
  ]
}

w_igv(options=options)

Widget Parameters

options: dict required dictionary of options for configuring the IGV browser. See Browser Creation for a list of available options. See Tracks for configuration options for each track.

Usage Notes

  • The IGV widget accepts both Latch paths and generic URLs.
  • If a Latch path is provided without an index, the widget will automatically generate and pull an index for the file.

Output Widget Reactivity

Output widgets are reactive to changes in their source data. When the source plot or data is updated, the widget display will automatically update to reflect the changes. Example:
import matplotlib.pyplot as plt
from lplots.widgets.plot import w_plot

# Create initial plot
fig, ax = plt.subplots()
line, = ax.plot([1, 2, 3], [1, 2, 3])
ax.set_title("Dynamic Plot")

# Display the plot
plot = w_plot(label="Updating Plot", source=fig)

# Update the plot data
line.set_ydata([2, 1, 3])
fig.canvas.draw()  # Plot will automatically update in the widget
I