Skip to main content

kx-plot

One-line matplotlib plots and themes for notebooks and scripts.

kx is a small, plain-Python package with .mplstyle themes, palettes and colourmaps. It needs nothing beyond matplotlib, numpy and pandas and works offline, so it also runs in Kaggle competition notebooks.

dark theme

Install

pip install kx-plot
import kx; kx.use('dark')

Kaggle

Attach the dataset instead (Add Input → Datasets → vhrabar/kx-plot), then:

import sys; sys.path.append('/kaggle/input/datasets/vhrabar/kx-plot')
import kx; kx.use('dark')

Usage

kx.use('light', palette='okabe', cmap='cividis')   # notebook default: theme, palette, colormap
kx.plot(x, y, z, 'scatter-grid-leg')               # spec: kind-theme-flag-...
kx.plot(x, y, 'bar-paper')                         # a theme in the spec applies to this plot only
kx.plot(df.value, spec='kde', by=df.group)         # one density curve per group
kx.plot(df.value, spec='box', by=df.group)         # one box per group (also ecdf, violin)
Token Values
kind line step area band scatter bar barh hist kde ecdf box violin
theme dark light paper science talk poster thesis
flags grid leg logx logy tight, plus stack norm cum (below)

stack works with area, bar, barh and hist. norm is a 100% stack for area and a density (area 1) for hist. cum makes hist cumulative; hist-norm-cum is the CDF. hist puts every series on the same bins, so the bars line up.

Unknown tokens raise an error instead of being guessed. Everything is inspectable: kx.grammar(), kx.grammar('area'), kx.show('dark'), kx.source('scatter').

rcParams can be overridden in kx.use with __ for dots: kx.use('dark', figure__figsize=(8, 4)).

Every kind, option, flag and config, with its output, is in the Example Usage notebook.

Palettes

Palettes for kx.use(theme, palette=...), they swap only the colours; a theme's other cycled properties (such as paper's linestyles) stay.

Name Source
okabe Okabe & Ito (2008)
tolbright tolvibrant tollight Paul Tol
tolhc tolmc Paul Tol
petroff6 petroff8 petroff10 Petroff (2021)
tab10 tab20 tableaucb Tableau
set1 set2 dark2 paired ColorBrewer
ibm IBM Design Colors

kx.palette('okabe') returns the hex codes. A list of colours works too: palette=['#264653', '#e9c46a'].

Colourmaps

Colourmaps for kx.use(theme, cmap=...) colour continuous values, such as a numeric z in scatter. Without cmap, the theme's own default applies. Add _r to any name to reverse it, e.g. cmap="thermal_r".

Name Type
viridis magma plasma inferno cividis Sequential, perceptually uniform
turbo Sequential, rainbow
coolwarm Diverging
berlin managua vanimo Diverging, dark centre
twilight Cyclic, for angles and phases
thermal haline deep Sequential, cmocean (vendored)
balance Diverging, cmocean (vendored)
batlow lipari hawaii oslo davos Sequential, Crameri (vendored)
vik roma bam cork Diverging, Crameri (vendored)
romaO Cyclic, Crameri (vendored)

kx.cmaps() lists the ones that are available in the installed matplotlib as those implemented in matplotlib 3.10 or newer are not vendored.

License

Released under the MIT License. See LICENSE.

Copyright © 2026 Vedran Hrabar

Vendored palettes and colourmaps keep their own licences; see kx/styles/palettes/LICENCES.md and kx/styles/cmaps/LICENCES.md.

Metadata

Release files for kx-plot 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kx-plot 0.2.0
File Size Uploaded
kx_plot-0.2.0.tar.gz 58.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kx-plot 0.2.0
File Interpreter ABI Platform
kx_plot-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 127.7 kB

Release files / kx_plot-0.2.0.tar.gz

Download URL kx_plot-0.2.0.tar.gz
Size 58.0 kB
Tags Source
SHA-256 checksum
How to use checksums
09b54f0e9a0eb5cd81e3e65334c0a43308e013dc6d8d447cefca22757ae1b562
BLAKE2b-256 checksum
How to use checksums
a4641814b89dcc7f8a0e84e6d9856c6b07e9998855a668232c0cfefc042b601a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Release files / kx_plot-0.2.0-py3-none-any.whl

Download URL kx_plot-0.2.0-py3-none-any.whl
Size 69.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fbec43d0022c325a47a4fc059bc31ed4f3de624bb26afa5d7ec5449f6583d792
BLAKE2b-256 checksum
How to use checksums
41764fc7f2dfbc7243af25474c295487975e0aaa9ac5f6b0baaf0bdd1d0e035d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page