Skip to main content

Hasty plotting for Altair, inspired by ggplot2's qplot

Project description

hastyplot

This library is completely generated from a marimo notebook.

You can inspect the full implementation/docs/demo/test suite be clicking the button below.

Open in molab

Hasty plotting for Altair, inspired by ggplot2's qplot.

from hastyplot import qplot

# Scatter plot
qplot(df, "x", "y")

# Histogram (x-only)
qplot(df, "x")

# With pipe
df.pipe(qplot, "x", "y", color="group")

Install

uv add hastyplot

Examples

# Scatter with color and smooth
qplot(cars, "Horsepower", "Miles_per_Gallon",
      color="Origin", smooth="loess",
      title="HP vs MPG", theme="minimal")

# Boxplot
qplot(cars, "Origin", "Miles_per_Gallon", mark="boxplot")

# Faceted scatter
qplot(cars, "Horsepower", "Miles_per_Gallon",
      facet_wrap="Cylinders", columns=3, width=200, height=150)

# Lines grouped without color
qplot(stocks, "date", "price", mark="line", group="symbol")

# Histogram with custom bins
qplot(cars, "Horsepower", bins=20, theme="clean")

Themes

Pass the theme parameter to change the look of any chart:

qplot(df, "x", "y", theme="clean")
  • "default" — Altair's built-in styling, no customization applied.
  • "clean" — No gridlines, dark axis colors, system-ui fonts, bold title.
  • "minimal" — Light gridlines, no axis domain lines, Libre Franklin / Helvetica Neue fonts, bottom-oriented legend, and a custom color palette.

API

There is only one function and it is called qplot. In this function data is the first argument so you can use df.pipe(qplot, "x", "y"). Here's all the input options:

Data & axes

  • data — DataFrame to plot.
  • x — column for the x-axis.
  • y — column for the y-axis. Omit for a histogram.

Aesthetics

  • color — column to map to color.
  • size — column to map to point size.
  • opacity — a fixed float (e.g. 0.5) or a column name.
  • group — column to group by without changing color. Useful for separate lines per group in a uniform color.

Mark & smoothing

  • mark — options: "scatter", "circle", "line", "bar", "boxplot", "hist".
  • smooth — overlay a trend line: "loess", "linear".
  • bandwidth — loess bandwidth, 0 to 1 (default 0.3). Lower = wigglier.
  • bins — number of histogram bins. Omit for Altair's default.

Faceting

  • facet_col / facet_row — column names for a facet grid.
  • facet_wrap — single column, wraps into rows.
  • columns — max columns before wrapping (default 3).

Layout & appearance

  • width / height — chart size in pixels (per panel when faceted).
  • title / subtitle — chart title and subtitle.
  • theme"default", "clean", or "minimal".
  • actions — show the Vega-Lite export menu (default False).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hastyplot-0.3.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hastyplot-0.3.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file hastyplot-0.3.0.tar.gz.

File metadata

  • Download URL: hastyplot-0.3.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hastyplot-0.3.0.tar.gz
Algorithm Hash digest
SHA256 cd32a4c6f00b7f396998415c0b49b75a44fab65e04aec79b92dc45016b0c1d64
MD5 abc39d2ddac456bbc47b7f7bd0c29f2d
BLAKE2b-256 a5726e8c1970667ae04c2999b05eb856e8596b1d1e9c4bf1324e9246c38c070a

See more details on using hashes here.

File details

Details for the file hastyplot-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: hastyplot-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for hastyplot-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fdb51be9aa90cb6250990b2b99d9b19ad2099bfc646aa168941c18f5424affac
MD5 d1fd5ebfdd9532031898be2a0a9215c3
BLAKE2b-256 5b3e5a7cf8c8dbe049a1f7799f5c4ca1fa0f0552cf70d5271544d0a0637b3a4b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page