Sensible date tick locator for matplotlib
Project description
datetick
Sensible numeric time and date tick labels for Matplotlib
Motivation
Matplotlib's default time tick labels are often poor, and adjusting them requires using locators and formatters on an ad-hoc basis. In addition, the interfaces for locators and formatters complex and non-intuitive and require study and experimentation.
datetick() contains logic for locators and formatters that apply to plots with arbitrary time ranges. One only needs to add the command datetick() after the usual Matplotlib plt.plot(...) command to have sensible and useable time tick labels.
Usage
import datetime as dt
import matplotlib.pyplot as plt
from datetick import datetick
dt1 = dt.datetime(2011, 1, 2)
dt2 = dt1 + dt.timedelta(days=1, hours=1, minutes=1)
plt.plot([dt1, dt2], [0.0,1.0])
datetick()
plt.show()
# or
# datetick('x') (use 'y' if y variable is a time)
# or
# datetick('x', axes=plt.gca())
# or
# fig, axes = plt.subplots(2)
# plt.plot([dt1, dt2], [0.0, 1.0])
# datetick('x', axes=axes[0])
Comparison to default Matplotlib
dir=x
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datetick-0.9.6.tar.gz.
File metadata
- Download URL: datetick-0.9.6.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b62a31d3f37ec714ed6b1afe54b6921e2959fcf510f896635e68672f98b7f8f7
|
|
| MD5 |
b1ac6c52835018a792dbddd8eaad7b2e
|
|
| BLAKE2b-256 |
94da195e3c9fcfc2f926bfd663a8580847ed88a029fdd98b1494a412acc7f49c
|
File details
Details for the file datetick-0.9.6-py3-none-any.whl.
File metadata
- Download URL: datetick-0.9.6-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e207040ae66030e01db3a81e9a1005b4f47eb9ea4291bf0999831fc33469d4d
|
|
| MD5 |
fa55b089888a972aa9faab9d8ff38cc1
|
|
| BLAKE2b-256 |
e312e702f5d2f238440bbb38d5f7243a996884ad0c4900b200f0423ad0409aa4
|