pyqtgraph-styler
Named Matplotlib-inspired plot styles and vector XKCD drawing for pyqtgraph. The package styles existing plots. It does not own data loading, calculations, interaction, axis ranges or application windows.
Installation
Install with one Qt binding:
python -m pip install "pyqtgraph-styler[pyside6]"
To install from a local checkout, run this from the project folder:
python -m pip install ".[pyside6]"
Matplotlib is a required dependency. It supplies the style catalogue and its compiled sketch-path calculation. No Matplotlib GUI backend or pyplot window is created. The Qt bindings are optional extras because applications often already have either PySide6 or PyQt6 installed.
One-line application
Create the plot normally, then apply a style:
import numpy as np
import pyqtgraph as pg
import pyqtgraph_styler as styler
app = pg.mkQApp()
window = pg.PlotWidget()
window.addLegend()
x = np.linspace(0, 10, 200)
window.plot(x, np.sin(x), name="y data")
window.setLabel("bottom", "x data")
styler.apply(window, "seaborn-v0_8-whitegrid")
window.show()
app.exec()
Use styler.available() for the catalogue. It contains Matplotlib’s public installed style names plus default and xkcd: ggplot, bmh, classic, fivethirtyeight, dark_background, grayscale, Solarize_Light2, tableau-colorblind10, and the seaborn-v0_8 variants, among others.
Call apply after adding native curves and legends, and again after adding new ones. The function deliberately does not hook future events or change global pyqtgraph defaults. Explicitly restyling a plot changes its curve colours and widths to the preset. Data and ranges stay unchanged.
Applications which already own series styling can keep those settings:
appearance = styler.load("ggplot")
appearance.apply(plot, curves=False, grid=False, fonts=False)
colour = appearance.colors[series_number % len(appearance.colors)]
load caches immutable presets. The same preset can style several figures; applying a dark style to one plot does not change another plot.
XKCD drawing
For ordinary PlotWidget.plot items, this also works:
styler.apply(window, "xkcd")
The original PlotDataItem, its marker item, data arrays and signals remain in place. Only its curve child is replaced with a sketch-capable curve. If your application keeps references to that child, create styler.DataItem instead. For directly created PlotCurveItem objects, use styler.CurveItem:
curve = styler.CurveItem(x, y, sketch=(1, 100, 2)) plot.addItem(curve)
Normal styles use pyqtgraph’s normal curve painter. XKCD converts only the visible drawing path through Matplotlib’s sketch operation; original samples are untouched. Gaps and step corners remain in the path. The resulting vector path is cached until data or drawing scale changes. Source data remains suitable for cursors, calculation and export to a data file. The visible stroke is intentionally displaced slightly, so use a normal style for precise visual readings. Curve and frame paths are sketched; scatter symbols, contour polygons, bar rectangles and text glyphs are not distorted. Text uses Comic Sans MS when installed; Qt otherwise selects the bundled Comic Neue font. The application does not choose or install sketch fonts. Area fills retain their original region.
Supported appearance and limits
Supported: figure/axes backgrounds, text and tick colours, font families, native grid visibility/colour, per-side frame visibility/colour/width, automatic curve colour cycles/widths and legend frame/background/text. The Qt layout and tick locator remain in use. Styles are visual translations, not pixel-identical Matplotlib output. Backend settings such as Agg chunking, TeX, path simplification and Matplotlib layout parameters have no corresponding effect. The fast preset does not accelerate pyqtgraph.
All style names are available, but not every rcParam is translated. Property cycles currently use colours; marker/dash cycles are not interpreted. Native pyqtgraph grid rendering also differs from Matplotlib. Existing application settings may intentionally override theme defaults, including grid visibility, font sizes and explicit series colours. Qt widget stylesheets (buttons/docks) are outside this plot-style package.
Vector export uses Qt’s QPainter with QSvgGenerator or QPdfWriter. With the tested Qt version, pyqtgraph 0.14’s separate SVGExporter fails on unstyled plots too; this package does not patch that exporter.
Supported versions: Python 3.10+, pyqtgraph 0.14.x, Matplotlib 3.10+. This first release is experimental. The curve-child integration is deliberately bounded to pyqtgraph 0.14 until later versions are tested.
Packaging and release
Build and validate locally:
python -m pip install -e ".[pyside6,dev]" python -m pytest python -m build python -m twine check dist/*
The wheel includes the font and its OFL licence. No resources are downloaded at runtime. For Nuitka include package data with --include-package-data=pyqtgraph_styler; Matplotlib’s own data must also be included by the build. Test the frozen program on a machine without Python.
Nothing is published by these commands. When a release is approved, uploading is a separate explicit step with python -m twine upload dist/*. The package name is not reserved until a successful upload to PyPI.
Maintenance
styles.py translates appearance. sketch.py owns the drawing adapter. tests checks all presets, source-data preservation, independent figures, sketch gaps, cache invalidation and vector export. examples/gallery.py is an interactive visual comparison. Keep rendering and data preparation outside this package.
Licences
Package code is MIT licensed. Comic Neue is distributed under the SIL Open Font License included in fonts/OFL.txt. The font comes from https://github.com/google/fonts/tree/main/ofl/comicneue . Matplotlib and pyqtgraph are dependencies with their own licences; their source is not copied into this package. This is an independent project, not an official Matplotlib, pyqtgraph or XKCD product.
Metadata
Release files for pyqtgraph-styler 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyqtgraph_styler-0.1.0.tar.gz | 49.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyqtgraph_styler-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 96.5 kB
Release files / pyqtgraph_styler-0.1.0.tar.gz
| Download URL | pyqtgraph_styler-0.1.0.tar.gz |
|---|---|
| Size | 49.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6187b3fc26979733fb58c31bd01035d6169252abc940aca1d77156188a9d347e
|
|
BLAKE2b-256 checksum How to use checksums |
a43e8acfa9dc2b860091cb0e628f6dc7776e53a79c9014fd3449adf3d3f67041
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.4
|
Release files / pyqtgraph_styler-0.1.0-py3-none-any.whl
| Download URL | pyqtgraph_styler-0.1.0-py3-none-any.whl |
|---|---|
| Size | 46.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
14b4f118a66d2d503e1ddc6360720578400f5f6f804b6cac5b84b39d8ac87a5d
|
|
BLAKE2b-256 checksum How to use checksums |
852c66bf43e4ccd21304d65f7fe4506817ed14ca5edcfb1a14527040f06852e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.4
|
Security for pyqtgraph-styler 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.