PyGWalker: Open Source Python Library for Minimal Coding Data Visualizations
Tags: programming, python
Published: 2023-03-13 07:24:33

As a programmer, you are always on the lookout for ways to make your job easier. Data visualization is a critical component of data analysis, but creating effective visualizations can be time-consuming and require extensive coding. Fortunately, there are open-source Python libraries that can help you create data visualizations with minimal coding. In this article, we will explore some of the best open-source Python libraries for minimal coding data visualizations.

## 1. PyGWalker

[**PyGWalker**](https://github.com/Kanaries/pygwalker) is an open-source Python library that allows data scientists to turn their pandas DataFrame into a Tableau-style user interface for visual analysis. With PyGWalker, you can create stunning visualizations with simple drag-and-drop operations. It works with both pandas and polars, making it a versatile tool for data visualization.

PyGWalker GitHub: https://github.com/Kanaries/pygwalker

## Tested Environments
- [x] Jupyter Notebook
- [x] Google Colab
- [x] Kaggle Code
- [x] Jupyter Lab (WIP: There're still some tiny CSS issues)
- [x] Jupyter Lite
- [x] Databricks Notebook (Since version `0.1.4a0`)
- [x] Jupyter Extension for Visual Studio Code (Since version `0.1.4a0`)
- [x] Hex Projects (Since version `0.1.4a0`)
- [x] Most web applications compatiable with IPython kernels. (Since version `0.1.4a0`)
- [x] **Streamlit (Since version `0.1.4.9`)**, enabled with `pyg.walk(df, env='Streamlit')`
- [ ] ...feel free to raise an issue for more environments.

## Setup pygwalker

Before using pygwalker, make sure to install the packages through the command line using pip or conda.

### pip

```bash
pip install pygwalker
```
> **Note**
> 
> For an early trial, you can install with `pip install pygwalker --upgrade` to keep your version up to date with the latest release or even `pip install git+https://github.com/Kanaries/pygwalker@main` to obtain latest features and bug-fixes.

### Conda-forge
```bash
conda install -c conda-forge pygwalker
```
or
```bash
mamba install -c conda-forge pygwalker
```
See [conda-forge feedstock](https://github.com/conda-forge/pygwalker-feedstock) for more help.

### Run PyGWalker online

You can run PyGWalker in [Google Colab](https://colab.research.google.com/drive/171QUQeq-uTLgSj1u-P9DQig7Md1kpXQ2?usp=sharing), [Kaggle Code](https://www.kaggle.com/asmdef/pygwalker-test), [Binder](https://mybinder.org/v2/gh/Kanaries/pygwalker/main?labpath=tests%2Fmain.ipynb) or [Graphic Walker Online Demo](https://graphic-walker.kanaries.net/) to test it out!


## Use pygwalker in Jupyter Notebook

Import pygwalker and pandas to your Jupyter Notebook to get started.

```python    
import pandas as pd
import pygwalker as pyg
```

You can use pygwalker without breaking your existing workflow. For example, you can call up Graphic Walker with the dataframe loaded in this way:

```python
df = pd.read_csv('./bike_sharing_dc.csv', parse_dates=['date'])
gwalker = pyg.walk(df)
```

And you can use pygwalker with polars (since `pygwalker>=0.1.4.7a0`):
```python
import polars as pl
df = pl.read_csv('./bike_sharing_dc.csv',try_parse_dates = True)
gwalker = pyg.walk(df)
```

![](https://docs-us.oss-us-west-1.aliyuncs.com/img/pygwalker/travel-ani-0-light.gif)

That's it. Now you have a Tableau-like user interface to analyze and visualize data by dragging and dropping variables.

![](https://docs-us.oss-us-west-1.aliyuncs.com/img/pygwalker/travel-ani-1-light.gif)

Cool things you can do with Graphic Walker:

+ You can change the mark type into others to make different charts, for example, a line chart:
![graphic walker line chart](https://user-images.githubusercontent.com/8137814/221894699-b9623304-4eb1-4051-b29d-ca4a913fb7c7.png)


+ To compare different measures, you can create a concat view by adding more than one measure into rows/columns.
![graphic walker area chart](https://user-images.githubusercontent.com/8137814/224550839-7b8a2193-d3e9-4c11-a19e-ad8e5ec19539.png)


+ To make a facet view of several subviews divided by the value in dimension, put dimensions into rows or columns to make a facets view. The rules are similar to Tableau.
![graphic walker scatter chart](https://user-images.githubusercontent.com/8137814/221894480-b5ec5df2-d0bb-45bc-aa3d-6479920b6fe2.png)

+ You can view the data frame in a table and configure the analytic types and semantic types.
![page-data-view-light](https://user-images.githubusercontent.com/8137814/221895610-76165bc6-95ee-4567-a55b-41d47d3310eb.png)


## 2. Matplotlib
**Matplotlib** is a popular Python library for creating static, animated, and interactive visualizations in Python. It provides an easy-to-use interface for creating complex visualizations with just a few lines of code. With Matplotlib, you can create line plots, scatter plots, bar plots, histograms, and much more.

- Matplotlib Documentation: https://matplotlib.org/stable/index.html
- Matplotlib Examples: https://matplotlib.org/stable/gallery/index.html

## 3. Seaborn
**Seaborn** is a Python library for creating beautiful and informative statistical graphics. It is built on top of Matplotlib and provides a high-level interface for creating stylish visualizations. Seaborn includes several built-in themes that can be used to create aesthetically pleasing visualizations.

- Seaborn Documentation: https://seaborn.pydata.org/installing.html

## 4. Plotly
**Plotly** is a Python library for creating interactive data visualizations. It includes several chart types, including scatter plots, line charts, bar charts, and more. With Plotly, you can create interactive dashboards and share your visualizations online.
- Plotly Documentation: https://plotly.com/python/

## 5. Bokeh
**Bokeh** is a Python library for creating interactive visualizations for modern web browsers. It provides an easy-to-use interface for creating complex visualizations with just a few lines of code. Bokeh includes several built-in tools that can be used to create interactive visualizations.
- Bokeh Documentation: https://docs.bokeh.org/en/latest/

## Conclusion

Data visualization is an essential part of data analysis, and open-source Python libraries have made it easier than ever to create stunning visualizations with minimal coding. In this article, we have explored some of the best open-source Python libraries for minimal coding data visualizations. PyGWalker is a particularly useful tool for creating Tableau-style user interfaces with drag-and-drop operations. Matplotlib, Seaborn, Plotly, and Bokeh are also great options for creating static or interactive visualizations. With these tools at your disposal, you can quickly and easily create effective data visualizations for your projects.

So, what are you waiting for? Try out these libraries and see how they can make your data visualization tasks more efficient and effective!