> ## Documentation Index
> Fetch the complete documentation index at: https://wiki.latch.bio/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Custom Plots from Any Library

> Latch Plots allows you to install and import any libraries to generate custom plots and display them in the notebook view.

In addition to [interactive, no-code Plot cell](/plots/plotting/plot-types), Latch Plots allows developers to programmatically use any library and generate plots of interest.

There are two main ways to programmatically create custom plots:

1. Display an image using libraries like `seaborn` or `matplotlib`

2. Display a figure from `plotly`

## Option 1: Display a plot image from `seaborn` or `matplotlib`

### Step 1: Install the Python packages

To install your Python libraries, first click on **Custom Data Analysis** to create a Python cell. Paste in the following Python code to install packages:

```python theme={null}
import os

os.system("/opt/mamba/envs/plots-faas/bin/pip install matplotlib")
```

<video autoPlay muted loop playsInline className="w-full aspect-video" class="rounded-md">
  <source src="https://mintcdn.com/latchbio/rZf7ybfryGn4thLo/images/plots/developer/install-packages.mp4?fit=max&auto=format&n=rZf7ybfryGn4thLo&q=85&s=a70831ec4471f3b94b5741507d65219f" data-path="images/plots/developer/install-packages.mp4" />
</video>

### Step 2: Display the plot as an image

To display a `matplotlib` or `seaborn` figure, first assign the figure to a variable, e.g. `fig`

```python theme={null}
import pandas as pd
import matplotlib.pyplot as plt

# Load the dataset
df = pd.read_csv("https://latch-public.s3.us-west-2.amazonaws.com/plots/test-data/iris.csv")

# Create the scatter plot
plt.figure(figsize=(10, 6))

print(df)

# Store the matplotlib figure in a `fig`variable
fig = plt.scatter(df['sepal.length'], df['sepal.width'], c='blue', label='Sepal')
plt.scatter(df['petal.length'], df['petal.width'], c='green', label='Petal')
```

Click on the `fig` variable to display the image in the output of the cell.&#x20;

<img src="https://mintlify.s3.us-west-1.amazonaws.com/latchbio/plots/developer/ScreenShot2024-12-04at6.31.16PM.png" alt="" />

## Option 2: Display a custom, interactive Plotly figure

First, click on **Custom Data Analysis** to create a new Python cell. Next, import the Plotly Express library and create your plot of interest.

In the example below, we created a scatter plot for the iris dataset, and save the Plotly object as a Python variable called `fig`.

```python theme={null}
import plotly.express as px

df = px.data.iris()

fig = px.scatter(
  df,
  x="sepal_length",
  y="sepal_width",
  template="simple_white"
)
```

Select the `fig` variable to display the interactive Plotly figure in the output of the cell.&#x20;

<img src="https://mintlify.s3.us-west-1.amazonaws.com/latchbio/plots/developer/ScreenShot2024-12-04at6.35.52PM.png" alt="" />
