nc-time-axis1.4.1
nc-time-axis1.4.1
Published
Provides support for a cftime axis in matplotlib
pip install nc-time-axis
Package Downloads
Authors
Project URLs
Requires Python
>=3.7
Dependencies
- cftime
(>=1.5)
- matplotlib
- numpy
- pre-commit
; extra == 'all'
- ipython
; extra == 'all'
- numpydoc
; extra == 'all'
- sphinx
; extra == 'all'
- sphinx-rtd-theme
; extra == 'all'
- codecov
; extra == 'all'
- pytest
(>=6.0) ; extra == 'all'
- pytest-cov
; extra == 'all'
- ipython
; extra == 'docs'
- numpydoc
; extra == 'docs'
- sphinx
; extra == 'docs'
- sphinx-rtd-theme
; extra == 'docs'
- codecov
; extra == 'test'
- pytest
(>=6.0) ; extra == 'test'
- pytest-cov
; extra == 'test'
nc-time-axis
Support for a cftime axis in matplotlib
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
import nc_time_axis
calendar = "360_day"
dt = [
cftime.datetime(year=2017, month=2, day=day, calendar=calendar)
for day in range(1, 31)
]
temperatures = [round(random.uniform(0, 12), 3) for _ in range(len(dt))]
plt.plot(dt, temperatures)
plt.margins(0.1)
plt.ylim(0, 12)
plt.xlabel("Date")
plt.ylabel("Temperature")
plt.show()
Reference
- cftime - Time-handling functionality from netcdf4-python.
- matplotlib - Plotting with Python.