Skip to main content

A plotting backend for the TimeSeriesQL library

Project description

Contributors Forks Stargazers Issues LinkedIn


TimeSeriesQL-Matplotlib

A plotting backend for the TimeSeriesQL library

Table of Contents

About The Project

This project adds a matplotlib plotting backend for the TimeSeriesQL project.

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

The requirements are in the requirements.txt file.

Installation

pip

pip install timeseriesql-matplotlib

manual

  1. Clone the timeseriesql-matplotlib
git clone https:://github.com/mbeale/timeseriesql-matplotlib.git
  1. Install library
cd timeseriesql-matplotlib
python setup.py install 

Usage

The charting library operates on TimeSeries objects. The Axes can be overriden to control the placement of the charts. All the below examples use the following code:

import matplotlib.pyplot as plt

from timeseriesql_matplotlib import MatplotlibTQL as mp
from timeseriesql.backends.csv_backend import CSVBackend

data = CSVBackend(x for x in "AAPL.csv")[:] #CSV of AAPL stock data header = (open, close, high, low, adj close)

Line Plot

mp().line_plot(data)
plt.show()

Line Plot Example

Stacked Plot

mp().stacked_plot(data)
plt.show()

Stacked Plot Example

Timebox Plot

mp().line_plot(data)
timebox_plot(data[:,0])
"""
the plot arguement defaults to auto but you can set a specific period
s    - second buckets
m    - minute buckets
h    - hour buckets
d    - day buckets
mth  - month buckets
y    - year buckets
"""

Timebox Plot Example

Distribution Plot

mp().dist_plot(data[:,0], percentiles=[25,75]) #percentiles are optional
plt.show()

Distribution Plot Example

Correlogram Plot

mp().correlogram_plot(data)
plt.show()

Correlogram Plot Example

Text Plot

mp().line_plot(data)
mp().text_plot(data[-1,0], title="A Nice Text Box", thresholds=[(0, 'green', 'white'), (20, 'cornflowerblue', 'white'), (None, 'darkorange', 'white')])

Text Plot Example

Layout Example

from matplotlib.gridspec import GridSpec

fig = plt.figure(constrained_layout=True, figsize=(20,20))

gs = GridSpec(4, 4, figure=fig)
ax1 = fig.add_subplot(gs[0, 0])
ax2 = fig.add_subplot(gs[0, 1])
ax3 = fig.add_subplot(gs[0, 2])
ax4 = fig.add_subplot(gs[0, 3])
ax5 = fig.add_subplot(gs[1:3, :3])
ax6 = fig.add_subplot(gs[1, 3])
ax7 = fig.add_subplot(gs[2, 3])
ax8 = fig.add_subplot(gs[3, :2])
ax9 = fig.add_subplot(gs[3, 2:])


mp().text_plot(data[:,0].mean(), ax=ax1, title="Avg Close")
mp().text_plot(data[:,1].mean(), ax=ax2, title="Avg High")
mp().text_plot(data[:,2].mean(), ax=ax3, title="Avg Low")
mp().line_plot(data[:,0], ax = ax4)
mp().line_plot(data, ax=ax5)
mp().line_plot(data[:,1], ax=ax6)
mp().line_plot(data[:,2], ax=ax7)
mp().line_plot(data[:,3], ax=ax8)
mp().line_plot(data[:,4], ax=ax9)

Text Plot Example

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Michael Beale - michael.beale@gmail.com

Project Link: https://github.com/mbeale/timeseriesql-matplotlib

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

timeseriesql-matplotlib-0.0.1.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

timeseriesql_matplotlib-0.0.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file timeseriesql-matplotlib-0.0.1.tar.gz.

File metadata

  • Download URL: timeseriesql-matplotlib-0.0.1.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for timeseriesql-matplotlib-0.0.1.tar.gz
Algorithm Hash digest
SHA256 735910448a3e87d9d0eabff50bf13e598919df39a2739bb9a4a2a4c73d80fe07
MD5 7fd6bb768da3e047aed4f111a51ef290
BLAKE2b-256 50fa9a4ba2c6aff20cb3a9c131bf466abea4161d2a925a77aa929fd1be442359

See more details on using hashes here.

File details

Details for the file timeseriesql_matplotlib-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: timeseriesql_matplotlib-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.8.1

File hashes

Hashes for timeseriesql_matplotlib-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 635af65f825988a31f33c573bf54f9c599f6132827edaca3722d051f80a29b7d
MD5 a192814a9b85ab8f7c69da09f4aaecc8
BLAKE2b-256 67a70a0d07d4749fde39132e83c3794b3615c05ced8f1e42222fb16d1c2819c7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page