Skip to content

Commit

Permalink
Release/v0.1.5 (#25)
Browse files Browse the repository at this point in the history
* Frame index col (#23)

* somewhat working

* now working reliable for 2d arrays

* diryt support for labels, legend

* multiplot working with pandas

* added test for multiplot

* cleaned up pandas api testing

* minor updates to pandas api

* updated docs with pandas walk through

* updated docs with pandas walk through

* fixing the tests

* Datetime axis (#24)

* added conversion from datetime to numeric

* added timedelta rounding

* somewhat works

* basic changes to docs

* works a bit better

* tests passing

* added more test

* updated docs

* updated docs

* cleaning up axis

* updated changelog
  • Loading branch information
CDonnerer committed Jan 18, 2021
1 parent 18fa9d9 commit 0975533
Show file tree
Hide file tree
Showing 14 changed files with 813 additions and 235 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ Changelog
=========


Version 0.1.5
-------------
- Allow to plot multiple scatters via 2d np arrays
- Added support for datetime types
- Added pandas visualisation example docs
- General support for adding legend to plot via ``label`` keyword


Version 0.1.4
-------------
- Fixed bug in x-axis drawing, spurious rounding
Expand Down
217 changes: 131 additions & 86 deletions docs/examples/basic_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,39 @@ Scatter plots can be created via the ``plot`` function::
>>> y = np.cos(x)
>>> plt.plot(x, y)

1.0┤ ++++++
| +++ +++
| ++ ++
| ++ ++
| ++ ++
| ++ ++
0.5┤ ++ ++
| ++ ++
| + +
| + +
| ++ ++
| ++ ++
0.0┤ + +
| ++ ++
| ++ ++
| ++ ++
| + +
| ++ ++
-0.5┤ ++ ++
| ++ ++
|++ ++ ++ ++
| ++ ++ ++ ++
| ++ ++ ++ ++
| +++ +++ +++ +++
-1.0┤ ++++++ ++++++
└┬----------------┬----------------┬-----------------┬----------------┬
-4 -2 0 2 4
1.0┤ ++++++
| +++ ++
| ++ ++
| ++ ++
| ++ ++
| ++ ++
0.6┤ ++ ++
| + +
| + ++
| ++ ++
| ++ ++
| + +
0.2┤ ++ ++
| ++ ++
| + +
| ++ ++
| ++ ++
| + +
-0.2┤ ++ ++
| ++ ++
| + +
| + ++
| ++ ++
| ++ ++
-0.6┤ ++ +
|++ + + ++
| ++ + ++ ++
| ++ ++ ++ ++
| ++ ++ ++ ++
| +++ +++ +++ +++
-1.0┤ ++++++ ++++++
└┬-------------------┬-------------------┬-------------------┬-------------------┬
-4 -2 0 2 4


It is possible to modify the appearance of the plot by passing keyword args,
Expand Down Expand Up @@ -93,6 +99,43 @@ using a similar syntax to `matplotlib`_. E.g. we could modify the above call to

Please refer to :ref:`api_reference` for the full list of possible options.

Multiple scatters can be plotted by using 2d arrays::


>>> import numpy as np
>>> import shellplot as plt
>>> x1 = np.arange(-3, 6, 0.01)
>>> y1 = np.cos(x)
>>> y2 = np.sin(x)
>>> x, y = np.vstack((x1, x1)), np.vstack((y1, y2))
>>> plt.plot(x, y, label=("cos", "sin"), figsize=(61, 21))

1.0┤ +++++ ****** +
| +++ +++ ** ** +++
| ++ ++** ** ++
| ++ ** ** ++
| ++ **++ ** ++
0.5┤ + ** + ** +
| ++ ** ++ ** +
| ++ * ++ * ++
| + ** + ** ++
| + ** + ** +
0.0┤ ++ * ++ * ++
|* + ** + ** ++
|** + ** + ** +
| * ++ * ++ * ++ *
| ** ++ ** ++ ** ++ *
-0.5┤ ** + ** + ** + **
| **++ ** ++ **++ **
| ** ** ++ ** **
| ++** ** ++ ++** **
| +++ ** ** +++ +++ ** ** + cos
-1.0┤++ ****** +++++ ***** * sin
└┬------------┬-------------┬------------┬------------┬-------
-3 -1 1 3 5



Histogram
-------------------

Expand All @@ -102,36 +145,42 @@ Histogram plots can be created via the ``hist`` function::
>>> import numpy as np
>>> import shellplot as plt
>>> x = np.random.randn(10000)
>>> plt.hist(x, bins=10)

counts
2836┤ -----
| | |-----
| | | |
| | | |
| | | |
| | | |
2127┤ | | |
| | | |
| | | |
| -----| | |
| | | | |
| | | | |
1418┤ | | | |-----
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
709┤ | | | | |
| -----| | | | |
| | | | | | |-----
| | | | | | | |
| | | | | | | |
| -----| | | | | | |-----
0┤ -----| | | | | | | | |-----
└┬--------------┬--------------┬--------------┬--------------┬---------
-4 -2 0 2 4
>>> plt.hist(x, bins=8)

counts
3220┤ ---------
| | |
| ---------| |
| | | |
| | | |
| | | |
2576┤ | | |
| | | |
| | | |
| | | |
| | | |
| | | |
1932┤ | | |
| | | |
| | | |
| | | |---------
| | | | |
| ---------| | | |
1288┤ | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
644┤ | | | | |
| | | | | |
| | | | | |---------
| ---------| | | | | |
| | | | | | | |
| | | | | | | |---------
0┤ ---------| | | | | | | |
└┬-------------------┬-------------------┬-------------------┬-------------------┬
-4 -2 0 2 4



Expand All @@ -144,35 +193,31 @@ Bar plots can be created via the ``bar`` function::
>>> import numpy as np
>>> import shellplot as plt
>>> x = np.logspace(0, 1, 3)
>>> plt.barh(x, labels=np.array(["bar_1", "bar_b", "bar_3"]))

|---------------------------------------------------------------------┐
| |
| |
| |
bar_3┤ |
| |
| |
| |
|---------------------------------------------------------------------
| |
| |
| |
bar_b┤ |
| |
| |
| |
|----------------------
| |
| |
| |
bar_1┤ |
| |
| |
| |
|-------
└┬-------------┬-------------┬------------┬-------------┬-------------┬
0 2 4 6 8 10
>>> plt.barh(x, labels=np.array(["bar_1", "bar_b", "bar_3"]), figsize=(61, 19))

|------------------------------------------------------------
| |
| |
bar_3┤ |
| |
| |
|------------------------------------------------------------
| |
| |
bar_b┤ |
| |
| |
|-------------------
| |
| |
bar_1┤ |
| |
| |
|------
└┬-----------┬-----------┬-----------┬-----------┬-----------┬
0.0 2.0 4.0 6.0 8.0 10.0



Box plot
-------------------
Expand Down
1 change: 1 addition & 0 deletions docs/examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ Examples
:maxdepth: 2

Basic usage <basic_usage>
Pandas visualisation <pandas>
EDA: Penguins <penguins_eda>

0 comments on commit 0975533

Please sign in to comment.