Skip to main content

napari-plot

License PyPI Anaconda-Server Badge Python Version tests codecov pre-commit PyPI - Downloads napari hub Documentation Status

Interactive plotting in napari or a standalone Qt viewer

napari-plot provides GPU-accelerated Line, Scatter, MultiLine, Centroids, Text, Region, InfLine, and Bar layers. It supports linear, logarithmic, and categorical axes, an interactive legend, data selection tools, and image display.

Usage

You can use napari-plot alongside napari where it is embedded as a dock widget. If using this option, controls are relegated to a toolbar where you can adjust layer properties like you would do in napari.

embedded

Or as a standalone app where only one-dimensional plotting is enabled. In this mode, controls take central stage and reflect napari's own behaviour where layer controls are embedded in the main application.

live-view

Data selection is also permitted by enabling one of the available selection tools.

scatter-select

Roadmap:

This is only provisional list of features that I would like to see implemented. It barely scratches the surface of what plotting tool should cover so as soon as the basics are covered, focus will be put towards adding more exotic features. If there are features that you certainly wish to be included, please modify the list below or create a new issue

  • Support for new layer types. Layers are based on napari's Layer, albeit in a two-dimensional setting. Supported and planned layers:
    • Line Layer - simple line plot.
    • Scatter Layer - scatter plot (similar to napari's Points layer).
    • Centroids/Segments Layer - horizontal or vertical line segments.
    • InfLine Layer - infinite horizontal or vertical lines that span over very broad range. Useful for defining regions of interest.
    • Region Layer - infinite horizontal or vertical rectangular boxes that span over very broad range. Useful for defining regions of interest.
    • Shapes Layer - napari's own Shapes layer
    • Points Layer - napari's own Points layer
    • Multi-line Layer - more efficient implementation of Line layer when multiple lines are necessary.
    • Bar - horizontal and vertical bar charts.
  • Proper interactivity of each layer type (e.g. moving Region or InfLine, adding points, etc...)
  • Intuitive interactivity. napari-plot will provide excellent level of interactivity with the plotted data. We plan to support several types of Tools that permit efficient interrogation of the data. We currently provide several zoom and select tools and hope to add few extras in the future.
    • Box-zoom - standard zooming rectangle. Simply left-mouse + drag/release in the canvas on region of interest
    • Horizontal span - zoom-in only in the y-axis by Ctrl + left-mouse + drag/release in the canvas.
    • Vertical span - span-in only in the x-axis by Shift + left-mouse + drag/release in the canvas.
    • Rectangle select - rectangle tool allowing sub-selection of data in the canvas. Similar to the Box-zoom but without the zooming part.
    • Polygon select - polygon tool allowing sub-selection of data in the canvas.
    • Lasso select - lasso tool allowing sub-selection of data in the canvas.
  • Interactive plot legend
  • Customizable axis visuals.
    • Plot axis enabling customization of tick/label size and color
    • Support for logarithmic and categorical scales
  • Add convenient plotting interface:
    • Add .plot functionality
    • Add .scatter functionality
    • Add .hbar and .vbar functionality
    • Add .imshow functionality

This napari plugin was generated with Cookiecutter using with @napari's cookiecutter-napari-plugin template.

Installation

napari-plot requires napari 0.10.0 and Python 3.11 or later. Use a Qt6 backend with pip install "napari-plot[pyqt6]" or pip install "napari-plot[pyside6]". Qt5 is no longer supported.

You can install napari-plot directly from PyPI via:

pip install napari-plot

or from the git repo:

git clone https://github.com/lukasz-migas/napari-plot.git
cd napari-plot
pip install -e '.[all]'

The plot widgets open in a tabified bottom dock in napari. Custom layers retain their individual controls; selecting several layers exposes shared opacity and blending controls. Built-in-only selections use napari's dynamic controls.

viewer.scene.camera and viewer.canvas.overlays expose the new model layout. Existing viewer.camera, viewer.text_overlay, viewer.legend, and viewer.grid_lines accessors refer to the same objects. The custom camera, log axes, and plot grid remain available.

Layer axis labels automatically populate the plot labels until those labels are edited explicitly. Unspecified text and legend font sizes follow the application's appearance font size; pass a number to fix the size.

Python 3.11 or later is required. See the documentation for standalone and embedded quick starts, layer examples, axis controls, interactions, and the public API.

Contributing

Contributions are very welcome. Install the test environment and run the tests with uv:

uv sync --no-dev --group test --extra pyqt6 --extra optional
uv run --no-sync pytest

Please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the BSD-3 license, "napari-plot" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Support

This project is supported by a Chan-Zuckerberg Initiative napari grant.

Metadata

Release files for napari-plot 0.4.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 napari-plot 0.4.0
File Size Uploaded Provenance Actions
napari_plot-0.4.0.tar.gz 528.6 kB Without provenance Details for napari_plot-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for napari-plot 0.4.0
File Interpreter ABI Platform Actions
napari_plot-0.4.0-py3-none-any.whl Python 3 none any Details for napari_plot-0.4.0-py3-none-any.whl

Total release size: 1.1 MB

Release files / napari_plot-0.4.0.tar.gz

Download URL napari_plot-0.4.0.tar.gz
Size 528.6 kB
Tags Source
SHA-256 checksum
How to use checksums
427f90611d05846a22a8757ac4ea7b9d382b7477280eef5f39523de410ce754e
BLAKE2b-256 checksum
How to use checksums
15d0c34b0767700b02fca0436f66bc0a0c035cdc990e212e70025538f2f57e0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / napari_plot-0.4.0-py3-none-any.whl

Download URL napari_plot-0.4.0-py3-none-any.whl
Size 592.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
caf63d66fab46b8aa85cdd3ff13b238e41458182d039b2667b9dc57b0d8db1d4
BLAKE2b-256 checksum
How to use checksums
33be0803c5675b2c5da678e13ee087c318874ee7950678eb265088713751c9c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for napari-plot 0.4.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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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