Skip to content

Commit

Permalink
More examples. #11.
Browse files Browse the repository at this point in the history
  • Loading branch information
onyxfish committed May 20, 2016
1 parent 748de1c commit d7f5135
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 5 deletions.
32 changes: 27 additions & 5 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,39 @@ TKTK
Multiple series
---------------

Multiple data series can be displayed on a single chart.
Multiple data series can be displayed on a single chart so long as they all use the same type of :class:`.Scale`.

TKTK
.. literalinclude:: ../examples/multiple_series.py
:language: python

.. figure:: ../examples/charts/multiple_series.svg

Shapes
======

Bars
----

TKTK
.. literalinclude:: ../examples/bars.py
:language: python

.. figure:: ../examples/charts/bars.svg

Columns
-------

TKTK
.. literalinclude:: ../examples/columns.py
:language: python

.. figure:: ../examples/charts/columns.svg

Dots
----

TKTK
.. literalinclude:: ../examples/dots.py
:language: python

.. figure:: ../examples/charts/dots.svg

Lines
-----
Expand All @@ -75,6 +87,16 @@ Lines

.. figure:: ../examples/charts/lines.svg

Mixing shapes
-------------

You can mix different shapes for different series on the same chart.

.. literalinclude:: ../examples/mixed_shapes.py
:language: python

.. figure:: ../examples/charts/mixed_shapes.svg

Scales
======

Expand Down
12 changes: 12 additions & 0 deletions examples/bars.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import leather

data = [
(3, 'Hello'),
(5, 'How'),
(9, 'Are'),
(4, 'You')
]

chart = leather.Chart('Bars')
chart.add_bars(data)
chart.to_svg('examples/charts/bars.svg')
12 changes: 12 additions & 0 deletions examples/columns.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import leather

data = [
('Hello', 3),
('How', 5),
('Are', 9),
('You', 4)
]

chart = leather.Chart('Columns')
chart.add_columns(data)
chart.to_svg('examples/charts/columns.svg')
12 changes: 12 additions & 0 deletions examples/dots.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import leather

data = [
(0, 3),
(4, 5),
(7, 9),
(8, 4)
]

chart = leather.Chart('Dots')
chart.add_dots(data)
chart.to_svg('examples/charts/dots.svg')
28 changes: 28 additions & 0 deletions examples/mixed_shapes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import leather

column_data = [
('Hello', 3),
('How', 5),
('Are', 9),
('You', 4)
]

line_data = [
('Hello', 1),
('How', 5),
('Are', 4),
('You', 3)
]

dot_data = [
('Hello', 3),
('How', 5),
('Are', 9),
('You', 4)
]

chart = leather.Chart('Mixed shapes')
chart.add_columns(column_data)
chart.add_lines(line_data)
chart.add_dots(dot_data)
chart.to_svg('examples/charts/mixed_shapes.svg')
20 changes: 20 additions & 0 deletions examples/multiple_series.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import leather

data1 = [
(0, 3),
(4, 5),
(7, 9),
(8, 4)
]

data2 = [
(2, 4),
(7, 3),
(6, 2),
(5, 9)
]

chart = leather.Chart('Multiple series')
chart.add_dots(data1)
chart.add_dots(data2)
chart.to_svg('examples/charts/multiple_series.svg')

0 comments on commit d7f5135

Please sign in to comment.