> For the complete documentation index, see [llms.txt](https://docs.gofigr.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gofigr.io/integrations/jupyter.md).

# Jupyter

GoFigr provides first-class support for Jupyter notebooks, capturing figures with complete execution context.

## What Gets Captured

When you create a figure in Jupyter with GoFigr enabled:

| Element              | Captured |
| -------------------- | -------- |
| Figure image         | ✅        |
| Cell source code     | ✅        |
| Cell execution order | ✅        |
| Variable values      | ✅        |
| Notebook metadata    | ✅        |
| Kernel info          | ✅        |

## Setup

Load the GoFigr extension in your first cell:

```python
%load_ext gofigr
```

That's it! GoFigr will:

* Use your default workspace from `gfconfig`
* Create an analysis named after your notebook
* Automatically capture all figures

## Supported Environments

| Environment                | Status                           |
| -------------------------- | -------------------------------- |
| JupyterLab                 | ✅ Full support                   |
| Jupyter Notebook (Classic) | ✅ Full support                   |
| VS Code Notebooks          | ✅ Full support                   |
| Google Colab               | ✅ Supported (with API key)       |
| Databricks                 | ✅ Supported (with configuration) |

## Example Workflow

```python
# Cell 1: Setup
%load_ext gofigr

import pandas as pd
import matplotlib.pyplot as plt

# Cell 2: Load data
df = pd.read_csv("experiment_results.csv")
print(f"Loaded {len(df)} rows")

# Cell 3: Visualize (automatically captured!)
plt.figure(figsize=(10, 6))
plt.scatter(df['x'], df['y'], c=df['category'], cmap='viridis')
plt.colorbar(label='Category')
plt.title("Experiment Results")
plt.xlabel("X Measurement")
plt.ylabel("Y Measurement")
```

The figure in Cell 3 is captured along with:

* The plotting code from Cell 3
* The data loading context from Cell 2
* The notebook's execution state

## Custom Configuration

For more control over workspace/analysis selection:

```python
%load_ext gofigr

from gofigr.jupyter import configure, FindByName

configure(
    workspace=FindByName("My Workspace"),
    analysis=FindByName("Data Analysis", create=True),
    auto_publish=True,
    default_metadata={'study': 'Trial 1'}
)
```

## Data Asset Tracking

Track the data files used in your analysis:

```python
%load_ext gofigr

# Use gf.read_csv instead of pd.read_csv
df = gf.read_csv('data/experiment.csv')

# The DataFrame is linked to the tracked asset
# Figures created from this data will be linked to the data version
```

When you publish a figure, GoFigr automatically tracks which data assets were used, ensuring complete reproducibility.

## QR Codes and Revision IDs

Each published figure displays:

* A **QR code** linking to the figure in GoFigr
* A **unique revision ID** for tracking

This allows anyone viewing your notebook to instantly access the full context in GoFigr.

***

## Git Import for Existing Notebooks

Already have notebooks in a Git repository? Import them directly without re-running:

1. Go to GoFigr → **Import** → **Git Repository**
2. Connect your GitHub/GitLab account
3. Select the repository and branches
4. GoFigr extracts all figures from all commits

See [Git Repository Import](/features/git-import.md) for details.
