Visualizations in Python Made Simple
- Mito — A spreadsheet that writes Python
Mito allows the users to generate graphs without coding. Mito provides a spreadsheet front-end, where the user can analyze and visual their data. Each edit made in Mito will generate the equivalent Python in the code cell below.
Here is how to install Mito:
python -m pip install mitoinstaller
python -m mitoinstaller install
Then open Jupyter Lab and call the Mitosheet
import mitosheet
mitosheet.sheet()
The full instructions can be found in the documentation.
Mito is built using the Plotly library, a strong python library that allows for interactive visualizations. I will touch on Plotly more later in this article.
The image below shows how to access the graphing menu inside Mito.
Beyond graphing, Mito also includes:
- pivot tables
- filters and sorts
- merging
- importing and exporting
- spreadsheet formulas
- summary statistics
- deduplicating
- and more!
Below is the auto-generated code that Mito creates from the graph above:
# Import plotly and create a figure
import plotly.graph_objects as go
fig = go.Figure()# Add the histogram traces to the figure
for column_header in ['Style']:
fig.add_trace(go.Histogram(x=ramen_ratings[column_header], name=str(column_header)))# Update the layout
# See Plotly documentation for customizations: https://plotly.com/python/reference/histogram/
fig.update_layout(
xaxis_title=str(0),
title="Style frequencies",
barmode='group'
)
fig.show(renderer="iframe")
2. Lux — automated chart creation
Lux allows you to pass in any DataFrame and it will automatically suggest graphs that you can choose from by clicking on them. You can see this in action in the gif below. This is a super fast way to visualize your data, as there is no coding required.
To install lux:
import lux
import pandas as pd
Lux’s intent feature allows you to select only the columns you want and it will suggest graphs for just those columns.
df.intent = ["Column1","Column2"]
df
3. Bokeh
To start using Bokeh:
pip install bokeh
Bokeh is a powerful package for creating interactive graphs that have a variety of uses. Unlike other packages, Bokeh has a variety of graphs that are specified for intense use cases.
Here are some example graphs from the Bokeh documentation:
Here is the full documentation
The one thing that all three of these packages share is that they are attempting to make data visualization more accessible. This will be increasingly important as more and more people enter the Python sphere.
I hope you find these packages helpful :)