Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
bjlittle committed Jun 9, 2021
1 parent ec528ae commit defc2fc
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 49 deletions.
66 changes: 66 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# nc-time-axis

<h4 align="center">
Support for a cftime axis in matplotlib
</h4>

<p align="center">
<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/master/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

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](https://github.com/SciTools/nc-time-axis/raw/master/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.
49 changes: 0 additions & 49 deletions README.rst

This file was deleted.

0 comments on commit defc2fc

Please sign in to comment.