Skip to main content

Display plots in kivy.

Project description

Coverage Status Github Build Status

Graph

The Graph widget is a widget for displaying plots. It supports drawing multiple plot with different colors on the Graph. It also supports a title, ticks, labeled ticks, grids and a log or linear representation on both the x and y axis, independently.

Screenshot

To display a plot. First create a graph which will function as a "canvas" for the plots. Then create plot objects e.g. MeshLinePlot and add them to the graph.

To create a graph with x-axis between 0-100, y-axis between -1 to 1, x and y labels of and X and Y, respectively, x major and minor ticks every 25, 5 units, respectively, y major ticks every 1 units, full x and y grids and with a red line plot containing a sin wave on this range::

from math import sin
from kivy.garden.graph import Graph, MeshLinePlot
graph = Graph(xlabel='X', ylabel='Y', x_ticks_minor=5,
x_ticks_major=25, y_ticks_major=1,
y_grid_label=True, x_grid_label=True, padding=5,
x_grid=True, y_grid=True, xmin=-0, xmax=100, ymin=-1, ymax=1)
plot = MeshLinePlot(color=[1, 0, 0, 1])
plot.points = [(x, sin(x / 10.)) for x in range(0, 101)]
graph.add_plot(plot)

The MeshLinePlot plot is a particular plot which draws a set of points using a mesh object. The points are given as a list of tuples, with each tuple being a (x, y) coordinate in the graph's units.

You can create different types of plots other than MeshLinePlot by inheriting from the Plot class and implementing the required functions. The Graph object provides a "canvas" to which a Plot's instructions are added. The plot object is responsible for updating these instructions to show within the bounding box of the graph the proper plot. The Graph notifies the Plot when it needs to be redrawn due to changes. See the MeshLinePlot class for how it is done.

Install

pip install kivy_garden.graph

CI

Every push or pull request run the GitHub Action CI. It tests the code on various OS and also generates wheels that can be released on PyPI upon a tag. Docs are also generated and uploaded to the repo as well as artifacts of the CI.

TODO

  • add your code

Contributing

Check out our contribution guide and feel free to improve the flower.

License

This software is released under the terms of the MIT License. Please see the LICENSE.txt file.

How to release

  • update __version__ in kivy-garden/graph/__init__.py to the latest version.
  • update CHANGELOG.md and commit the changes
  • call git tag -a x.y.z -m "Tagging version x.y.z"
  • call python setup.py bdist_wheel --universal and python setup.py sdist, which generates the wheel and sdist in the dist/* directory
  • Make sure the dist directory contains the files to be uploaded to pypi and call twine check dist/*
  • then call twine upload dist/* to upload to pypi.
  • call git push origin master --tags to push the latest changes and the tags to github.

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

kivy_garden.graph-0.4.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

kivy_garden.graph-0.4.0-py2.py3-none-any.whl (19.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file kivy_garden.graph-0.4.0.tar.gz.

File metadata

  • Download URL: kivy_garden.graph-0.4.0.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for kivy_garden.graph-0.4.0.tar.gz
Algorithm Hash digest
SHA256 4150f454b91dc025c37e69f81d7c1cb521e9164bd8e7db44b1855bf3d715264c
MD5 0261bfa80fe9810ef631281e14e35ff6
BLAKE2b-256 792015f5a3e9f6a19168719433e8929f66f28dc534e30da35cdb447b2032e849

See more details on using hashes here.

File details

Details for the file kivy_garden.graph-0.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: kivy_garden.graph-0.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for kivy_garden.graph-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 30cd05e6de5fb85e68a2e2d2215ae2a7989bf03a5dc45d45256a78a3cbed44eb
MD5 730d75202799acdc35fbfb5c761e3334
BLAKE2b-256 5596d3a37741d4d0b235f150d1fa9c0d02100a8ccbe2bfbb260282735a06aec8

See more details on using hashes here.

Supported by

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