Skip to main content

Personal python toolbox to make interactive plot in python notebooks

Project description

daaf-plot

PyPI version License: MIT

daaf-plot is a python toolbox to make interactive plot in python notebooks.

Installation

Install using pip:

$ pip install daaf-plot

Usage

The primary goal of the present toolbox is to help the creation of interactive plots. Nevertheless, it also provides a function to open a matplotlib figure from a given list of settings (number of rows and columns, padding, etc.) as well as some stylistic options which can be used outside python notebooks.

Interactive plots

To make an interactive plot, you need:

  1. to enable the %matplotlib widget magic in a notebook;
  2. an xarray.DataArray containing the data to plot.

Import InteractiveLinePlot or InteractivePColorMesh from daaf_plot.figure, instantiate with:

>>> fig = InteractiveLinePlot(
...     data_array,
...     x_dim='the_x_dim',
...     line_dim='the_line_dim',
...     facet_dim=...,
...     open_figure_kwargs=dict(...),
... )

for a line plot and with:

>>> fig = InteractivePColorMesh(
...     data_array,
...     x_dim='the_x_dim',
...     y_dim='the_y_dim',
...     facet_dim=...
...     open_figure_kwargs=dict(...),
... )

for a pcolormesh. This creates an abstract figure object, which you can then open using:

>>> fig.interactive_show()

Have at look at the examples in the examples/ repository!

Open a matplotlib figure

The daaf_plot.geometry.open_figure() function can be used to open a matplotlib figure, even outside python notebooks.

Stylistic options

Some matplotlib stylistic options are provided when importing daaf_plot.style:

  • scale linlogp;
  • color map deep (from seaborn) and its reversed counterpart;
  • a unified function daaf_plot.style.set_font_size() to set font size in figures;
  • ...

In addition, my custom style sheet is stored in src/daaf_plot/style/laptop.mplstyle and can be used as follows:

>>> import matplotlib.pyplot as plt
>>> plt.style.use('daaf_plot.style.laptop')

Todo-list

  • write docstrings
  • write documentation
  • add type hints

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

daaf_plot-1.0.1.tar.gz (11.7 MB view details)

Uploaded Source

Built Distribution

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

daaf_plot-1.0.1-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file daaf_plot-1.0.1.tar.gz.

File metadata

  • Download URL: daaf_plot-1.0.1.tar.gz
  • Upload date:
  • Size: 11.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for daaf_plot-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7f18298c02540ff663e5a7e0dadad21f578a48265d04f2b9eef0d069d1f6e7aa
MD5 6d6e86ab4946e72ad8f9fe0db343c93f
BLAKE2b-256 a4f9de71434c3b60b4501167f8d51a5ae9f9f1e8e90a1abc5c5176c03e3f0c80

See more details on using hashes here.

File details

Details for the file daaf_plot-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: daaf_plot-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for daaf_plot-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 abe3a95dc985f9303e2645d3e05f586240651e26fc46a60197f6de7866b83d67
MD5 fd510f24b80110a96e30f947a1615ce4
BLAKE2b-256 7099e5952326d60dff20c45ea5140e63c146321865a01af0f418bfe9d3aad9cb

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