https://github.com/scitools/nc-time-axis
Provides support for a cftime axis in matplotlib
https://github.com/scitools/nc-time-axis
axis cftime matplotlib
Last synced: about 1 year ago
JSON representation
Provides support for a cftime axis in matplotlib
- Host: GitHub
- URL: https://github.com/scitools/nc-time-axis
- Owner: SciTools
- License: bsd-3-clause
- Created: 2016-06-21T12:50:47.000Z (about 10 years ago)
- Default Branch: main
- Last Pushed: 2025-06-12T08:02:18.000Z (about 1 year ago)
- Last Synced: 2025-06-12T09:20:00.692Z (about 1 year ago)
- Topics: axis, cftime, matplotlib
- Language: Python
- Homepage: https://nc-time-axis.readthedocs.io/en/stable/
- Size: 712 KB
- Stars: 59
- Watchers: 12
- Forks: 33
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
# nc-time-axis
Support for a cftime axis in matplotlib
| | |
|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ⚙️ CI | [](https://github.com/SciTools/nc-time-axis/actions/workflows/ci-citation.yml) [](https://github.com/SciTools/nc-time-axis/actions/workflows/ci-locks.yml) [](https://github.com/SciTools/nc-time-axis/actions/workflows/ci-manifest.yml) [](https://github.com/SciTools/nc-time-axis/actions/workflows/ci-wheels.yml) [](https://results.pre-commit.ci/latest/github/SciTools/nc-time-axis/main) |
| 💬 Community | [](https://github.com/SciTools/nc-time-axes/blob/main/CODE_OF_CONDUCT.md) [](https://github.com/SciTools/nc-time-axis/discussions) |
| 📖 Documentation | [](https://nc-time-axis.readthedocs.io/en/stable/?badge=stable) |
| 📈 Health | [](https://codecov.io/gh/SciTools/nc-time-axis) |
| ✨ Meta | [](https://github.com/astral-sh/ruff) [](https://scientific-python.org/specs/spec-0000/) [](https://github.com/SciTools/nc-time-axis/blob/main/LICENSE) [](https://anaconda.org/conda-forge/nc-time-axis) |
| 📦 Package | [](https://doi.org/10.5281/zenodo.6472640) [](https://anaconda.org/conda-forge/nc-time-axis) [](https://pypi.org/project/nc-time-axis/) [](https://pypi.org/project/nc-time-axis/) |
| 🧰 Repo | [](https://github.com/SciTools/nc-time-axis/commits/main) [](https://github.com/SciTools/nc-time-axis/graphs/contributors) [](https://github.com/SciTools/nc-time-axis/releases) |
| |
## Installation
Install `nc-time-axis` either with `conda`:
```shell
conda install -c conda-forge nc-time-axis
```
Or `pip`:
```shell
pip install nc-time-axis
```
## Example
```python
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()
```

## License
`nc-time-axis` is distributed under the terms of the [BSD-3-Clause](https://spdx.org/licenses/BSD-3-Clause.html) license.
## [#ShowYourStripes](https://showyourstripes.info/s/globe)
**Graphics and Lead Scientist**: [Ed Hawkins](http://www.met.reading.ac.uk/~ed/home/index.php), National Centre for Atmospheric Science, University of Reading.
**Data**: Berkeley Earth, NOAA, UK Met Office, MeteoSwiss, DWD, SMHI, UoR, Meteo France & ZAMG.
#ShowYourStripes is distributed under a
Creative Commons Attribution 4.0 International License