Skip to content

Commit

Permalink
Axis round int (#14)
Browse files Browse the repository at this point in the history
* fixed link to examples page in readme

* fixed limits to ints if they are ints

* fixed hist axis scaling

* added n_ticks property to axis

* updated docs with new axis

* removed unneeded marker

* fixed the axis tests
  • Loading branch information
CDonnerer authored Dec 21, 2020
1 parent 3b13772 commit 72cefeb
Show file tree
Hide file tree
Showing 11 changed files with 212 additions and 200 deletions.
59 changes: 29 additions & 30 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,36 +45,35 @@ Shellplot loosely replicates the `matplotlib`_ API, it's as easy as::
>>> df = plt.load_dataset("penguins")
>>> plt.plot(df["bill_length_mm"], df["flipper_length_mm"], color=df["species"])


flipper_length_mm
232.0┤ o o o o o o o
| ooo o o o
| o ooo
| o oooo
| o oo o oo ooo oooo o
| o o o o o o oo o o
217.0┤ o o oo oo oo o
| o ooo oooooooooo o
| oo o o o
| + ooooooo ooooo o oo* * *
| o * *
| + o * ** * *
202.0┤ + + * ** ** *
| + ++++ ++ ++ * * * **** *
| +++ ++++ + *+ ** *****
| + +++++ ++ +++++++ + + * * * *** * **
| + + + ++ + ++++ + *+*** *
|+ + ++ ++++ +++++++++ + **** *
187.0┤ + + + + ++ +++ +* * * * *
| ++ + +++++ + + + *
| + ++ + ++ * *
| + + + +
| + + + + * + Adelie
| + * Chinstrap
172.0┤ + o Gentoo
--------------┬--------------┬-------------┬--------------┬----------
32.0 38.0 44.0 50.0 56.0
bill_length_mm
232┤ o o o o o o o
| ooo o o o
| o ooo
| o oooo
| o oo o oo ooo oooo o
| o o o o o o oo o o
217┤ o o oo oo oo o
| o ooo oooooooooo o
| oo o o o
| + ooooooo ooooo o oo* * *
| o * *
| + o * ** * *
202┤ + + * ** ** *
| + ++++ ++ ++ * * * **** *
| +++ ++++ + *+ ** *****
| + +++++ ++ +++++++ + + * * * *** * **
| + + + ++ + ++++ + *+*** *
|+ + ++ ++++ +++++++++ + **** *
187┤ + + + + ++ +++ +* * * * *
| ++ + +++++ + + + *
| + ++ + ++ * *
| + + + +
| + + + + * + Adelie
| + * Chinstrap
172┤ + o Gentoo
└┬--------------┬--------------┬-------------┬--------------┬----------
32 38 44 50 56
bill_length_mm


Shellplot also provides a convenient integration with `pandas`_. Simply set the
Expand All @@ -95,6 +94,6 @@ information on PyScaffold see https://pyscaffold.org/.


.. _documentation: https://shellplot.readthedocs.io/en/latest/
.. _examples: https://shellplot.readthedocs.io/en/latest/examples.html
.. _examples: https://shellplot.readthedocs.io/en/latest/examples/index.html
.. _matplotlib: https://matplotlib.org/contents.html#
.. _pandas: https://pandas.pydata.org/
122 changes: 61 additions & 61 deletions docs/examples/basic_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Scatter plots can be created via the ``plot`` function::
| ++ ++ ++ ++
| +++ +++ +++ +++
-1.0┤ ++++++ ++++++
----------------┬----------------┬-----------------┬----------------┬
-4.0 -2.0 0.0 2.0 4.0
└┬----------------┬----------------┬-----------------┬----------------┬
-4 -2 0 2 4


Histogram plots
Expand All @@ -53,37 +53,37 @@ Histogram plots can be created via the ``hist`` function::

>>> import numpy as np
>>> import shellplot as plt
>>> x = np.random.randn(5000)
>>> x = np.random.randn(10000)
>>> plt.hist(x, bins=10)

counts
1435.0_____
| | |_____
| | | |
| | | |
| | | |
| | | |
1077.0┤ | | |
| | | |
| | | |
| | | |
| _____| | |
| | | | |
719.0┤ | | | |_____
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
361.0┤ | | | | |
| _____| | | | |
| | | | | | |_____
| | | | | | | |
| | | | | | | |
| _____| | | | | | |_____
3.0┤ _____| | | | | | | | |_____
---------------┬---------------┬----------------┬-------------------
-4.0 -2.0 0.0 2.0 4.0
2836-----
| | |-----
| | | |
| | | |
| | | |
| | | |
2127┤ | | |
| | | |
| | | |
| -----| | |
| | | | |
| | | | |
1418┤ | | | |-----
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
709┤ | | | | |
| -----| | | | |
| | | | | | |-----
| | | | | | | |
| | | | | | | |
| -----| | | | | | |-----
0┤ -----| | | | | | | | |-----
└┬--------------┬--------------┬--------------┬-----------------------
-4 -2 0 2 4



Expand Down Expand Up @@ -123,8 +123,8 @@ Bar plots can be created via the ``bar`` function::
| |
| |
|-------
-------------┬-------------┬------------┬-------------┬-------------┬
0 2 4 6 8 10
└┬-------------┬-------------┬------------┬-------------┬-------------┬
0 2 4 6 8 10


Pandas integration
Expand All @@ -136,39 +136,39 @@ parameter::

>>> import pandas as pd
>>> pd.set_option("plotting.backend", "shellplot")
>>> x = np.random.randn(1000)
>>> x = np.random.randn(10000)
>>> my_series = pd.Series(data=x, name="my_fun_distribution")
>>> my_series.hist(bins=10)

counts
233.0_____
| | |
| | |_____
| | | |
| | | |
| | | |
176.0┤ | | |
| | | |_____
| _____| | | |
| | | | | |
| | | | | |
| | | | | |
119.0┤ | | | | |
| | | | | |
| | | | | |
| | | | | |_____
| | | | | | |
| _____| | | | | |
62.0 | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| _____| | | | | | |_____
| | | | | | | | | |
5.0┤ _____| | | | | | | | |_____
------------┬-----------┬------------┬-----------┬------------┬------
-3.1 -1.9 -0.7 0.5 1.7 2.9
my_fun_distribution
2636-----
| | |-----
| | | |
| | | |
| | | |
| | | |
1977┤ | | |
| | | |
| -----| | |
| | | | |
| | | | |
| | | | |-----
1318┤ | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| -----| | | | |
659┤ | | | | | |
| | | | | | |-----
| | | | | | | |
| | | | | | | |
| -----| | | | | | |
| | | | | | | | |-----
0┤ -----| | | | | | | | |-----
└┬-----------┬-----------┬-----------┬-----------┬-----------┬---------
-3.4 -2.0 -0.6 0.8 2.2 3.6
my_fun_distribution



Expand Down
Loading

0 comments on commit 72cefeb

Please sign in to comment.