Skip to main content

A Python package for chartly multiple plots.

Project description

chartly Package

GitHub license GitHub release (latest by date) GitHub issues GitHub pull requests GitHub contributors GitHub last commit GitHub commit activity GitHub top language GitHub search hit counter GitHub stars GitHub watchers

chartly is a lightweight scientific plotting library designed to simplify the process of building visualisations. It provides a clean and intuitive interface for generating statistical plots, geographic visualisations, overlays, and multi-plot figures without requiring complex setup or boilerplate code.

Whether you are exploring distributions, comparing datasets, visualising geographic data, or building composite visualisations, Chartly enables you to move from data to insight with minimal effort.

Chartly provides a small set of high-level methods that simplify the plotting workflow:

  • add_subplot(...) -> create a new subplot
  • add_subplots(...) -> create multiple subplots at once
  • add_overlay(...) -> add additional plots to an existing subplot
  • add_basemap(...) -> create geographic visualisations using map projections
  • render() -> display the final figure

Project Status

Here's the current status of our workflows:

Workflow Status
Testing Suite Continuous-Integration
Deployment Suite Continuous-Deployment
Sphinx Documentation Sphinx-docs
Guard Main Branch Guard Main Branch
Code Quality Checker Lint Codebase

Components

The Chartly codebase is organised as follows:

.
├── chartly/
│   ├── __init__.py
│   ├── base.py
│   ├── chartly.py
│   ├── charts.py
│   ├── utilities.py
│   └── tests/
│       ├── __init__.py
│       └── test_chartly.py
├── docs/
│   ├── __init__.py
│   ├── source/
│   │   ├── conf.py
│   │   ├── index.rst
│   │   ├── Plot.rst
│   │   ├── Multiplots.rst
│   │   └── Basemap.rst
├── requirements/
│   ├── testing.txt
│   ├── staging.txt
│   └── production.txt
├── .gitignore
├── LICENSE
├── MANIFEST.in
├── README.md
├── VERSION
├── requirements.txt
└── setup.py

Installation

Install Chartly directly from PyPI:

pip install chartly

Examples

The following examples demonstrate how to use Chartly for common visualisation tasks, from simple plots to more advanced multi-plot configurations.


Single Plot

The following example generates a scatter plot with custom styling.

"""Scatter Plot of Sample Data"""

import chartly
import numpy as np

args = {
    "super_title": "Scatter of the Sample Data",
    "super_xlabel": "X",
    "super_ylabel": "Y",
}

chart = chartly.Chart(args)

x_range = np.arange(200)
sample_data = np.random.randn(200)

chart.add_subplot(
    "scatter",
    [x_range, sample_data],
    customs={"color": "royalblue", "size": 50, "marker": "o"},
)

chart.render()

This visualisation highlights how Chartly supports customisation while maintaining a simple interface.

Scatter Plot Example


Multiple Subplots

Chartly simplifies the process of generating multiple related plots within a single figure.

"""Distribution Analysis Using Multiple Subplots"""

import chartly
import numpy as np

args = {
    "super_title": "Distribution Analysis",
    "super_xlabel": "X",
    "super_ylabel": "Y",
    "share_axes": False,
}

chart = chartly.Chart(args)

data = np.random.randn(200)

chart.add_subplots(
    ["probability_plot", "dotplot", "normal_cdf"],
    data=data,
)

chart.render()

This example produces multiple statistical views of the same dataset without requiring loops or manual payload construction.

Multiple Subplots Example


Overlay Example

Chartly also supports overlaying multiple plots within the same subplot for richer analysis.

"""Overlaying Density on a Histogram"""

import chartly
import numpy as np

args = {
    "super_title": "Overlay Example",
    "super_xlabel": "X",
    "super_ylabel": "Y",
}

chart = chartly.Chart(args)

data = np.random.randn(1000)

chart.add_subplot("histogram", data)
chart.add_overlay("density", data)

chart.render()

In this example, a density curve is layered on top of a histogram, allowing both distribution and frequency to be visualised together.

Overlay Example


Basemap

Chartly also supports geographic visualisations with basemaps, making it possible to overlay contour data on map projections using the same simplified plotting interface.

"""Simple Basemap Example"""

import chartly
import numpy as np

super_axes_labels = {
    "super_title": "Simple Usage Of Basemap Example",
    "share_axes": False,
}

plot = chartly.Chart(super_axes_labels)

nlats, nlons = 73, 145
delta = 2.0 * np.pi / (nlons - 1)
lats = 0.5 * np.pi - delta * np.indices((nlats, nlons))[0, :, :]
lons = delta * np.indices((nlats, nlons))[1, :, :]
wave = 0.75 * (np.sin(2.0 * lats) ** 8 * np.cos(4.0 * lons))
mean = 0.5 * np.cos(2.0 * lats) * ((np.sin(2.0 * lats)) ** 2 + 2.0)
z = wave + mean

plot.add_basemap(
    lon=lons * 180.0 / np.pi,
    lat=lats * 180.0 / np.pi,
    values=z,
    customs={
        "proj": "eck4",
        "lon_0": 0,
        "draw_countries": True,
        "draw_parallels": True,
        "draw_meridians": True,
        "mask": z < 0,
        "contour": True,
        "hatch": True,
        "hatch_customs": {"type": "mask"},
    },
)

plot.render()

This example demonstrates how Chartly can plot contour data on a global map projection while keeping the user-facing interface minimal and readable.

Basemap Example


Documentation

Full documentation is available via Sphinx:

https://ec-intl.github.io/chartly/

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

chartly-1.1.0.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

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

chartly-1.1.0-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file chartly-1.1.0.tar.gz.

File metadata

  • Download URL: chartly-1.1.0.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for chartly-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e1d0deb70e4c470cb15cb8df60f01f483609ae3a357903fa94a302a67f7b0ec8
MD5 b43d1bbd2f2e63dbefc60020a4314ff9
BLAKE2b-256 9600119fe162f2822744cd159798bb98ad465d9c9d1f95f72c494c7af387cea8

See more details on using hashes here.

File details

Details for the file chartly-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: chartly-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for chartly-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b1428f5a7396848c3b1f064c248846b7714b63bd58ca8680b131d68d5317933
MD5 2ac320f1d0f8c5abf358bbe9c61dd626
BLAKE2b-256 df8377d22cff5e70f98c9c78bbc6fce15434f8f4dfcba2c7c72b5ce7ce1209bb

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