Skip to content

Latest commit

 

History

History
127 lines (88 loc) · 3.99 KB

File metadata and controls

127 lines (88 loc) · 3.99 KB

By Tim Hopper: tdhopper.com

alt text alt text

Build Status

An Introduction to Python Plotting for Exploratory Data Analysis

Available at pythonplot.com

Contributing

The site is generated from plots in the Examples.ipynb Python 3, Jupyter notebook.

Development Setup

Requirements:

  • Python 3.11+
  • R 4.0+ (install via Homebrew on macOS: brew install r, or from CRAN)
  • uv for Python package management

Quick Start:

# Set up development environment (installs Python & R dependencies)
make dev_environment

# Or manually:
# 1. Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# 2. Install Python dependencies
uv pip install -r requirements.txt

# 3. Install R packages
./setup_r.sh

Each plot in the notebook is tagged with metadata using Jupyter cell tags. You can view the cell tags in your notebook with View > Cell Toolbar > Tags.

The tags look like this:

ex
name:scatter-with-regression
package:ggplot

If you are using Jupyter lab, these are available through the Cell Tools left sidebar menu:

{
    "tags": [
        "ex",
        "name:scatter-with-regression",
        "package:ggplot"
    ]
}

ex identifies the cell as an example. The name tag corresponds to an item in the names dictionary in render.py. The package tag corresponds to a package in the packages dict in render.py.

The site layout current allows for ~46 characters in the code window. Please keep this in mind and wrap your code to avoid too much side scrolling.

At the moment, the code must return a png image into the output cell. With modern versions of plotly (v5+), images are rendered locally using Kaleido - no authentication required.

A Markdown comment can be added within triple quotes on the first line of the cell. (This currently doesn't work for R cells.)

Building the Site

# Quick render (uses existing notebook without re-execution)
make qrender

# Full build (executes notebook, then renders)
make render

# Run tests
make test

After rendering, launch a local server from the web directory:

cd web && python -m http.server

CI/CD

The project uses GitHub Actions for continuous integration and deployment:

  • Pushes to master: Automatically deployed to production on Netlify
  • Other branches: Create preview deployments on Netlify
  • Requires secrets: NETLIFY_AUTH_TOKEN and NETLIFY_SITE_ID