Skip to main content

Provides support for a cftime axis in matplotlib

Project description

nc-time-axis

Support for a cftime axis in matplotlib

cirrus-ci codecov pre-commit.ci conda-forge pypi black license contributors

Installation

Install nc-time-axis either with conda:

    conda install -c conda-forge nc-time-axis

Or pip:

    pip install nc-time-axis

Example

import random

import cftime
import matplotlib.pyplot as plt

from nc_time_axis import CalendarDateTime

calendar = "360_day"
dt = [
    cftime.datetime(year=2017, month=2, day=day, calendar=calendar)
    for day in range(1, 31)
]
cdt = [CalendarDateTime(item, calendar) for item in dt]
temperatures = [round(random.uniform(0, 12), 3) for _ in range(len(cdt))]

plt.plot(cdt, temperatures)
plt.margins(0.1)
plt.ylim(0, 12)
plt.xlabel("Date")
plt.ylabel("Temperature")
plt.show()

alt text

Reference

  • cftime - Time-handling functionality from netcdf4-python.
  • matplotlib - Plotting with Python.

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

nc-time-axis-1.3.1.tar.gz (60.1 kB view details)

Uploaded Source

Built Distribution

nc_time_axis-1.3.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file nc-time-axis-1.3.1.tar.gz.

File metadata

  • Download URL: nc-time-axis-1.3.1.tar.gz
  • Upload date:
  • Size: 60.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.0

File hashes

Hashes for nc-time-axis-1.3.1.tar.gz
Algorithm Hash digest
SHA256 2d7ce655adde2df5794805d6055707e22d60ea0405234d8077b716508f95fed7
MD5 193b31ab5433da809b25df965b6f1ffc
BLAKE2b-256 af26fa4c59b0947d59a1191d6132dee6cfd19ca94dbda3dc0bf2744601e1c362

See more details on using hashes here.

File details

Details for the file nc_time_axis-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: nc_time_axis-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.9.0

File hashes

Hashes for nc_time_axis-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 da907626779793df1b4569ced4d7a81914c8c3e036501f1739dc82aac0e8a173
MD5 72037b1de942a1cca6ff1d1ff8e680e3
BLAKE2b-256 99954df3f9bb5473e4babe3c0a272da80e4026ded4b2b40ce39bfbeaa428881a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page