# nc-time-axis
<h4 align="center">
Support for a cftime axis in matplotlib
</h4>
<p align="center">
<a href="https://cirrus-ci.com/github/SciTools-/nc-time-axis">
<img src="https://api.cirrus-ci.com/github/SciTools/nc-time-axis.svg?branch=main"
alt="cirrus-ci">
</a>
<a href='https://nc-time-axis.readthedocs.io/en/stable/?badge=stable'>
<img src='https://readthedocs.org/projects/nc-time-axis/badge/?version=stable' alt='Documentation Status' />
</a>
<a href="https://codecov.io/gh/SciTools/nc-time-axis">
<img src="https://codecov.io/gh/SciTools/nc-time-axis/branch/main/graph/badge.svg?token=JicwCCHwLd"
alt="codecov">
</a>
<a href="https://results.pre-commit.ci/latest/github/SciTools/nc-time-axis/main">
<img src="https://results.pre-commit.ci/badge/github/SciTools/nc-time-axis/main.svg"
alt="pre-commit.ci">
</a>
<a href="https://anaconda.org/conda-forge/nc-time-axis">
<img src="https://img.shields.io/conda/vn/conda-forge/nc-time-axis?color=orange&label=conda-forge&logo=conda-forge&logoColor=white"
alt="conda-forge">
</a>
<a href="https://pypi.org/project/nc-time-axis/">
<img src="https://img.shields.io/pypi/v/nc-time-axis?color=orange&label=pypi&logo=python&logoColor=white"
alt="pypi">
</a>
<a href="https://github.com/psf/black">
<img src="https://img.shields.io/badge/code%20style-black-000000.svg"
alt="black">
</a>
<a href="https://github.com/SciTools/nc-time-axis/blob/main/LICENSE">
<img src="https://img.shields.io/github/license/SciTools/nc-time-axis?style=plastic"
alt="license">
</a>
<a href="https://github.com/SciTools/nc-time-axis/graphs/contributors">
<img src="https://img.shields.io/github/contributors/SciTools/nc-time-axis?style=plastic"
alt="contributors">
</a>
</p>
## 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
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()
![alt text](https://github.com/SciTools/nc-time-axis/raw/main/example_plot.png "Example plot with cftime axis")
## Reference
* [cftime](https://github.com/Unidata/cftime) - Time-handling functionality from netcdf4-python.
* [matplotlib](http://matplotlib.org/) - Plotting with Python.
Raw data
{
"_id": null,
"home_page": "https://github.com/SciTools/nc-time-axis",
"name": "nc-time-axis",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "axis,cftime,matplotlib",
"author": "SciTools Developers",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/39/c7/ceaba2047ef4e08660a5a89a71cea30547bddb0e51236dab2dcb771a6fe1/nc-time-axis-1.4.1.tar.gz",
"platform": null,
"description": "# nc-time-axis\n\n<h4 align=\"center\">\n Support for a cftime axis in matplotlib\n</h4>\n\n<p align=\"center\">\n\n<a href=\"https://cirrus-ci.com/github/SciTools-/nc-time-axis\">\n <img src=\"https://api.cirrus-ci.com/github/SciTools/nc-time-axis.svg?branch=main\"\n alt=\"cirrus-ci\">\n</a>\n<a href='https://nc-time-axis.readthedocs.io/en/stable/?badge=stable'>\n <img src='https://readthedocs.org/projects/nc-time-axis/badge/?version=stable' alt='Documentation Status' />\n</a>\n<a href=\"https://codecov.io/gh/SciTools/nc-time-axis\">\n <img src=\"https://codecov.io/gh/SciTools/nc-time-axis/branch/main/graph/badge.svg?token=JicwCCHwLd\"\n alt=\"codecov\">\n</a>\n<a href=\"https://results.pre-commit.ci/latest/github/SciTools/nc-time-axis/main\">\n <img src=\"https://results.pre-commit.ci/badge/github/SciTools/nc-time-axis/main.svg\"\n alt=\"pre-commit.ci\">\n</a>\n<a href=\"https://anaconda.org/conda-forge/nc-time-axis\">\n <img src=\"https://img.shields.io/conda/vn/conda-forge/nc-time-axis?color=orange&label=conda-forge&logo=conda-forge&logoColor=white\"\n alt=\"conda-forge\">\n</a>\n<a href=\"https://pypi.org/project/nc-time-axis/\">\n <img src=\"https://img.shields.io/pypi/v/nc-time-axis?color=orange&label=pypi&logo=python&logoColor=white\"\n alt=\"pypi\">\n</a>\n<a href=\"https://github.com/psf/black\">\n <img src=\"https://img.shields.io/badge/code%20style-black-000000.svg\"\n alt=\"black\">\n</a>\n<a href=\"https://github.com/SciTools/nc-time-axis/blob/main/LICENSE\">\n <img src=\"https://img.shields.io/github/license/SciTools/nc-time-axis?style=plastic\"\n alt=\"license\">\n</a>\n<a href=\"https://github.com/SciTools/nc-time-axis/graphs/contributors\">\n <img src=\"https://img.shields.io/github/contributors/SciTools/nc-time-axis?style=plastic\"\n alt=\"contributors\">\n</a>\n</p>\n\n\n## Installation\nInstall `nc-time-axis` either with `conda`:\n```shell\n conda install -c conda-forge nc-time-axis\n```\nOr `pip`:\n```shell\n pip install nc-time-axis\n```\n\n\n## Example\n\n import random\n\n import cftime\n import matplotlib.pyplot as plt\n import nc_time_axis\n\n calendar = \"360_day\"\n dt = [\n cftime.datetime(year=2017, month=2, day=day, calendar=calendar)\n for day in range(1, 31)\n ]\n temperatures = [round(random.uniform(0, 12), 3) for _ in range(len(dt))]\n\n plt.plot(dt, temperatures)\n plt.margins(0.1)\n plt.ylim(0, 12)\n plt.xlabel(\"Date\")\n plt.ylabel(\"Temperature\")\n plt.show()\n\n![alt text](https://github.com/SciTools/nc-time-axis/raw/main/example_plot.png \"Example plot with cftime axis\")\n\n\n## Reference\n* [cftime](https://github.com/Unidata/cftime) - Time-handling functionality from netcdf4-python.\n* [matplotlib](http://matplotlib.org/) - Plotting with Python.\n\n\n",
"bugtrack_url": null,
"license": "BSD 3-Clause",
"summary": "Provides support for a cftime axis in matplotlib",
"version": "1.4.1",
"project_urls": {
"Code": "https://github.com/SciTools/nc-time-axis",
"Discussions": "https://github.com/SciTools/nc-time-axis/discussions",
"Download": "https://github.com/SciTools/nc-time-axis",
"Homepage": "https://github.com/SciTools/nc-time-axis",
"Issues": "https://github.com/SciTools/nc-time-axis/issues"
},
"split_keywords": [
"axis",
"cftime",
"matplotlib"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0189dbeab77a217f8fbda97a637acf1e3f0ce8c9c9fb3f5e5d1ff843da859520",
"md5": "4b250acc4fad0adb1be71182d54a2a07",
"sha256": "96a6fb28cede0d07998fcd666599f76e51a086e1929fbcbfb758c1d0f3e7b0d1"
},
"downloads": -1,
"filename": "nc_time_axis-1.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4b250acc4fad0adb1be71182d54a2a07",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 17757,
"upload_time": "2022-04-20T11:29:00",
"upload_time_iso_8601": "2022-04-20T11:29:00.000444Z",
"url": "https://files.pythonhosted.org/packages/01/89/dbeab77a217f8fbda97a637acf1e3f0ce8c9c9fb3f5e5d1ff843da859520/nc_time_axis-1.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "39c7ceaba2047ef4e08660a5a89a71cea30547bddb0e51236dab2dcb771a6fe1",
"md5": "ac5df48dfb774c27d57b6464ef2cdeaf",
"sha256": "72d80f492f34bbf59490838d8cb3d92f14e88900b0ee35498b2b33c82795eb81"
},
"downloads": -1,
"filename": "nc-time-axis-1.4.1.tar.gz",
"has_sig": false,
"md5_digest": "ac5df48dfb774c27d57b6464ef2cdeaf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 66231,
"upload_time": "2022-04-20T11:29:01",
"upload_time_iso_8601": "2022-04-20T11:29:01.471811Z",
"url": "https://files.pythonhosted.org/packages/39/c7/ceaba2047ef4e08660a5a89a71cea30547bddb0e51236dab2dcb771a6fe1/nc-time-axis-1.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-04-20 11:29:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SciTools",
"github_project": "nc-time-axis",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nc-time-axis"
}