|
2 | 2 |
|
3 | 3 | # Multiplex |
4 | 4 |
|
5 | | -Multiplex is a Python library that builds on matplotlib, providing new visualizations to help you explore your data and explain it better. |
| 5 | +Multiplex is a visualization library for Python built on [matplotlib](https://github.com/matplotlib/matplotlib/). |
| 6 | +Multiplex follows the principle that visualizations should tell a story in a beautiful way. |
| 7 | +This package is built with the intent of making it as easy as possible to transform data into beautiful visualizations. |
6 | 8 |
|
7 | | -Creating narrative-driven visualizations involves re-imagining matplotlib's plots. |
8 | | -Multiplex follows best-practices to help you create visualizations. |
9 | | -The library adds the capability to add a description to visualizations and moves the legend to the top. |
| 9 | +> The instructions in this README.md file will get you a copy of the project up and running. |
| 10 | +> For use-cases of Multiplex, check out the [Jupyter Notebook examples](https://github.com/NicholasMamo/multiplex-plot/tree/master/examples). |
| 11 | +> To read more about Multiplex, read the [documentation](https://nicholasmamo.github.io/multiplex-plot/). |
10 | 12 |
|
11 | | -In addition, Multiplex includes: |
| 13 | +## Who is Multiplex for? |
12 | 14 |
|
13 | | -- A brand new text visualization modul to create text graphics or to annotate data anywhere on the plot, |
14 | | -- A brand new graph visualization, |
15 | | -- New matplotlib styles to make your data stand out. |
| 15 | +Multiplex is aimed at data scientists, researchers, students and all those who work with data and are familiar with Python. |
| 16 | +This library aims to make it easier to explore and explain data by creating beautiful visualizations. |
16 | 17 |
|
17 | | - |
| 18 | +## Why Multiplex? |
| 19 | + |
| 20 | +> If Multiplex is based on matplotlib, why not use matplotlib directly? |
| 21 | +
|
| 22 | +Multiplex does not replace matplotlib. |
| 23 | +Anything that you can do with Multiplex, you can also do with matplotlib. |
| 24 | +What Multiplex does is make it easier to create beautiful visualizations. |
| 25 | +This is achieved by providing: |
18 | 26 |
|
19 | | -The instructions in this README.md file will get you a copy of the project up and running. |
20 | | -For use-cases of Multiplex, check out the Jupyter Notebook examples in the [examples](https://github.com/NicholasMamo/multiplex-plot/tree/master/examples) directory. |
21 | | -To read more about Multiplex, read the [documentation](https://nicholasmamo.github.io/multiplex-plot/). |
| 27 | +* Custom matplotlib styles; |
| 28 | +* Functionality to caption visualizations; |
| 29 | +* Functionality to annotate any visualization with text; and |
| 30 | +* New types of visualizations not available in matplotlib, such as the network graph and text-based visualizations. |
| 31 | + |
| 32 | +## How do I use Multiplex? |
22 | 33 |
|
23 | 34 | ### Prerequisites |
24 | 35 |
|
25 | 36 | Multiplex is based on [matplotlib](https://github.com/matplotlib/matplotlib). |
26 | | -You can install matplotlib using `python -m pip install -U matplotlib`. |
| 37 | +You can install matplotlib using pip: `python -m pip install -U matplotlib`. |
27 | 38 | More details about it are available in [matplotlib's repository](https://github.com/matplotlib/matplotlib). |
28 | 39 |
|
| 40 | +Multiplex also uses the following libraries in certain visualizations: |
| 41 | + |
| 42 | +* [networkx](https://github.com/networkx/networkx) |
| 43 | +* [pandas](https://github.com/pandas-dev/pandas) |
| 44 | + |
29 | 45 | ### Installing |
30 | 46 |
|
31 | | -You can install Multiplex using `python -m pip install -U multiplex-plot`. |
| 47 | +You can install Multiplex using pip: `python -m pip install -U multiplex-plot`. |
32 | 48 |
|
33 | | -## Running the tests |
| 49 | +### Creating visualizations |
34 | 50 |
|
35 | | -The tests use [unittest](https://docs.python.org/3/library/unittest.html). |
36 | | -Each visualization has its own unit tests. |
37 | | -You can run the tests individually: |
| 51 | +Creating visualizations with Multiplex is very easy. |
| 52 | +For example, you can create a text visualization with a simple function call, including all styling options: |
38 | 53 |
|
39 | | -``` |
40 | | -python3 -m unittest multiplex.tests.test_drawable |
| 54 | +```python |
| 55 | + import matplotlib.pyplot as plt |
| 56 | + from multiplex import drawable |
| 57 | + plt.style.use(os.path.join(sys.path[0], '..', 'styles', "multiplex.style")) |
| 58 | + viz = drawable.Drawable(plt.figure(figsize=(10, 2))) |
| 59 | + paragraph = """Anthony Lopes is a Portuguese professional footballer who plays for Olympique Lyonnais as a goalkeeper. He came through the youth ranks at Lyon, being called to the first team in 2011 and making his debut the following year.""" |
| 60 | + style = { 'align': 'justify', 'fontfamily': 'serif', 'alpha': 0.9, 'lineheight': 1.25, 'lpad': 0.1, 'rpad': 0.1 } |
| 61 | + viz.draw_text_annotation(paragraph, **style) |
| 62 | + viz.set_title('Profile: Anthony Lopes', loc='left') |
| 63 | + viz.set_caption("""Wikipedia is a useful repository to get more information about anything. Below is an excerpt from the Wikipedia profile of footballer Anthony Lopes.""") |
| 64 | + plt.show() |
41 | 65 | ``` |
42 | 66 |
|
43 | | -Or you can run the tests using the `tests.sh` script: |
| 67 | + |
44 | 68 |
|
45 | | -``` |
46 | | -chmod +x tests.sh |
47 | | -./tests.sh |
48 | | -``` |
| 69 | +All it takes to draw a simple text visualization is 10 lines of code: |
| 70 | + |
| 71 | +1. Three lines to import matplotlib, Multiplex and the visualization style; |
| 72 | +2. Three lines to set up the visualization object, load the data and set the style; |
| 73 | +3. Four lines to draw and show the visualization, including a title and caption. |
| 74 | + |
| 75 | +Multiplex abstracts the tedious process of manually programming which elements go where, and lets you create beautiful visualizations with ease. |
| 76 | + |
| 77 | +For a quick start, check out the [Jupyter Notebook examples](https://github.com/NicholasMamo/multiplex-plot/tree/master/examples) for an easy-to-follow tour of Multiplex's capabilities. |
| 78 | + |
| 79 | +## Example visualizations |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
49 | 86 |
|
50 | | -## Built With |
| 87 | +## Built with |
51 | 88 |
|
52 | 89 | * [matplotlib](https://github.com/matplotlib/matplotlib) |
| 90 | +* [networkx](https://github.com/networkx/networkx) |
| 91 | +* [pandas](https://github.com/pandas-dev/pandas) |
53 | 92 |
|
54 | 93 | ## Versioning |
55 | 94 |
|
|
0 commit comments