Active Hackathon

A Deep Dive into PyeCharts, A Python Tool For Data Visualization

In the context of analytics, data visualization is critical because it allows users or clients to view large amounts of data and simultaneously extract important insights that can propel the business forward.

In the context of analytics, data visualization is critical because it allows users or clients to view large amounts of data and simultaneously extract important insights that can propel the business forward. When it comes to Pythonic methods, there are several to choose from, such as Matplotlib, Seaborn, and others. However, there are relatively few that have an interactive plot in a pythonic approach. In this post, we will look into PyeCharts, a Python-based tool that can generate interactive plots in a few lines of code in a variety of formats. The major points to be discussed in this article are listed below.

Table of Contents 

  1. About Data Visualization
  2. Python-based Tools for Visualization
  3. Data Visualization with PyeCharts

Let’s start the discussion by understanding what data visualization is.


Sign up for your weekly dose of what's up in emerging technology.

About Data Visualization

The practice of putting information into a visual context, such as a map or graph, to make it easier for the human brain to absorb and extract insights from. The primary purpose of data visualization is to make identifying patterns, trends, and outliers in huge data set easier. The phrase is frequently used interchangeably with other terms such as information graphics, information visualization, and statistical graphics.

Data visualization is a data science technique that asserts that after data has been collected, processed, and modelled, it must be seen in order to draw conclusions. Data visualization is part of a larger field called data presentation architecture (DPA), which aims to find, retrieve, alter, format, and transfer data as quickly as possible.

Data visualization is required for almost every operation. Teachers may use it to display test results, computer scientists can use it to improve artificial intelligence (AI), and executives can use it to share information with stakeholders. Large-scale data projects also necessitate it. Businesses needed a way to quickly and easily gain an overview of their data as they accumulated large volumes of data during the early years of the big data trend. 

Python-based Tools for Visualization

In this section, we will overview some of the famous python-based tools used for data visualization.


Matplotlib is a Python data visualization and 2-D plotting library. It is the Python community’s most popular and widely used plotting library. It comes with an interactive environment that can be used on a variety of platforms. Matplotlib is a Python library that can be used in Python scripts, the Python and IPython shells, Jupyter notebooks, web application servers, and more. 

Tkinter, GTK+, wxPython, Qt, and other GUI toolkits can be used to embed plots into applications. So we can make plots, bar charts, pie charts, histograms, scatterplots, error charts, power spectra, stemplots, and any other visualization chart you want with Matplotlib.


Seaborn is a Matplotlib-based Python data visualization framework that is tightly linked with NumPy and pandas data structures. Seaborn offers a number of dataset-oriented plotting routines that work with data frames and arrays that contain entire datasets. 

Then it executes the necessary statistical aggregation and mapping tasks on its own to build the user’s desired informative visualizations. It’s a high-level interface for making visually appealing and useful statistical visuals, which are crucial for studying and comprehending data.


Plotly is a graphing library that can be used to create data visualizations for free. Plotly ( is a web-based data visualization tool that is built on top of the Plotly JavaScript library (plotly.js). 

It can be used to create web-based data visualizations that can be displayed in Jupyter notebooks or web applications using Dash or saved as individual HTML files. Scatter plots, histograms, line charts, bar charts, pie charts, error bars, box plots, multiple axes, sparklines, dendrograms, 3-D charts, and other chart types are available in Plotly.


Most data visualization libraries don’t have much support for making maps or working with geographic data, which is why Geoplotlib is such a useful Python library. It facilitates the creation of geographical maps in particular, with a variety of map types such as dot-density maps, choropleths, and symbol maps available.

One thing to keep in mind is that installation requires NumPy and Pyglet, but this isn’t a major drawback. Especially since you want to make geographical maps, and Geoplotlib is the only excellent map-making option available.

Data Visualization with PyeCharts

In this section, we will try to plot various types of charts using Pyecharts.

PyeCharts is a class library that allows you to create an Echarts chart. Echarts is a Baidu open-source data visualization JS library. Echarts generates excellent graphical visual effects, and Pyecharts is docked with Python, making it easy to use the data generation map directly in Python.

In our Jupyter Notebook, Pyecharts work similarly to how we use visualization libraries in Python. PyeCharts offers a variety of configuration options, allowing you to quickly create the chart you want.

Let’s start with the library by first installing it. While I was searching for this tool, the code available in its official documentation works perfectly on a specific version of it. If you install directly without specifying the version, some of the plots may not be available.

All the charts that we will be creating here will get available as the HTML files in the local directory.

! pip install pyecharts==0.5.11

Please note that all the charts that we will be creating here will get available as the HTML files in the local directory.

Bar Chart

Here we will plot a simple Multibar chart that shows sales of cars across various manufacturers.

from pyecharts import Bar
Bar = Bar("Months Vs Sales of Car", "Various Manufactures")
Bar.add("Mahindra", ['MAY','JUNE','JUL','AUG'], [45,38,20,50], IS_MORE_UTILS = True)
Bar.add("Tata", ['MAY','JUNE','JUL','AUG'], [40,48,38,50], IS_MORE_UTILS = True)
Bar.add("Kia", ['MAY','JUNE','JUL','AUG'], [50,42,15,20], IS_MORE_UTILS = True)
Bar.render('bar.html') # Generates a Bar.html file in the specified directory
Dynamic Scatter Chart

As we know the scatter plots very well, here dynamic scatter plot is nothing but we have added some extra animation with distinct points with distinct symbolic representation. 

from pyecharts import EffectScatter
es =EffectScatter("Dynamic scatter plot for random X and Y points")
es.add("", [10], [18], symbol_size=20, effect_scale=3.5, effect_period=3, symbol="pin")
es.add("", [20], [9], symbol_size=12, effect_scale=4.5, effect_period=4,symbol="rect")
es.add("", [30], [15], symbol_size=30, effect_scale=5.5, effect_period=5,symbol="roundRect")
es.add("", [40], [40], symbol_size=10, effect_scale=6.5, effect_brushtype='fill',symbol="diamond")
es.add("", [50], [30], symbol_size=16, effect_scale=5.5, effect_period=3,symbol="arrow")
es.add("", [60], [20], symbol_size=6, effect_scale=2.5, effect_period=3,symbol="triangle")
Nested Pie Chart

Here we will plot a nested version of Pie plot and which is pretty simple to plot. We just need to add further labels and values by using .add method and by specifying the radius carefully.

from pyecharts import Pie
pie =Pie("Pie illustration example", title_pos='center', width=1000, height=600)
pie.add("", ['A', 'B', 'C', 'D', 'E', 'F'], [335, 321, 234, 135, 251, 148], radius=[40, 55],is_label_show=True)
pie.add("", ['H', 'I', 'J'], [335, 679, 204], radius=[0, 30], legend_orient='vertical', legend_pos='left')
pie.render('nested pie.html')
Liquid Level Chart

The liquid plot is one such plot which I have found only this framework, and plotting it very simple just takes 3 lines. Animation of the plot does satisfy its name.  

from pyecharts import Liquid
liquid =Liquid("Waterlevel indication")
liquid.add("Liquid", [0.7328])
Gauge Chart

You have seen various analogue meters or processing meters, PyeCharts does provide it under the Guage plot as shown below.

from pyecharts import Gauge
gauge = Gauge('project completion progress')
gauge.add('progress table', 'completion rate' , 73.28)
Funnel Chart

A funnel chart is used to show the chronological events, ascending or descending numbers. PyeChart example of funnel chart as shown below. 

from pyecharts import Funnel
Attr = ['Cognitive ',' understand ',' recognized ',' Consider ',' intention ',' purchase ']
value = [120, 100, 80, 60, 40, 20]
Funnel = Funnel('customer purchase analysis')
Funnel.add('Cloth Purchase', Attr, value, is_label_show = True, label_pos = 'inside', legend_orient='vertical', legend_pos='right',label_text_color = '# fff')
Funnel.render('Funnel.html') # Generates files in the specified directory
Line Chart

The line chart is used to show the information as a series of data points connected by a line. Below is an example of a line chart.

from pyecharts import Line
attr =["Shirt", "T-Shirt", "Jeans", "Kurtas", "Salvar", "Shoes"]
v1 =[5, 20, 36, 10, 10, 100]
v2 =[55, 60, 16, 20, 15, 80]
line =Line("Pacing chart for Shop A and Shop B","X-axis-->Cloths, Y-axis-->Pricing")
line.add("Shop A", attr, v1, mark_point=["average"])
line.add("Shop B", attr, v2, is_smooth=True, mark_line=["max", "average"])
Polar Chart

Polar charts are circular charts that display information as polar coordinates using values and angles. Polar charts can be used to display scientific data. Below is an example of a Polar Chart.

from pyecharts import Polar
Radius_ =['Monday_','Tuesday_','Wednesday_','Thursday_','Friday_','Saturday_','Sunday_']
po =Polar("Polar_coordinate_system_", width=1200, height=600)
po.add("A", [1, 2, 3, 4, 3, 5, 1], radius_data=Radius_, type='barRadius', is_stack=True)
po.add("B", [2, 4, 6, 1, 2, 3, 1], radius_data=Radius_, type='barRadius', is_stack=True)
po.add("C", [1, 2, 3, 4, 1, 2, 5], radius_data=Radius_, type='barRadius', is_stack=True)
Radar Chart

A radar chart is a two-dimensional graphical representation of multivariate data with three or more quantitative variables represented on axes that start at the same point. Below is an example of a Radar Plot.

from pyecharts import Radar
schema =[ ("Sales", 6500), ("management", 16000), ("information Technology", 30000), ("Customer service", 38000), ("Research and development", 52000), ("market", 25000)]
v1 =[[4300, 10000, 28000, 35000, 50000, 19000]]
v2 =[[5000, 14000, 28000, 31000, 42000, 21000]]
radar =Radar()
radar.add("Budget allocation", v1, is_splitline=True, is_axisline_show=True)
radar.add("Actual overhead", v2, label_color=["#4e79a7"], is_area_show=False)

Final Words

Through this post, we have seen what data visualization is and its importance. Later we have seen some of the widely used Python-based visualization tools. Lastly, we saw the PyeCharts package in Python practically. The charts built using these package are dynamic, so the numbers appear with a transparent background whenever the mouse hovers over them. The graphs built here are very appealing. To create pleasing charts, less code is required when using this package. There is also support for the Creative theme palette with PyeCharts.


More Great AIM Stories

Vijaysinh Lendave
Vijaysinh is an enthusiast in machine learning and deep learning. He is skilled in ML algorithms, data manipulation, handling and visualization, model building.

Our Upcoming Events

Conference, in-person (Bangalore)
Machine Learning Developers Summit (MLDS) 2023
19-20th Jan, 2023

Conference, in-person (Bangalore)
Rising 2023 | Women in Tech Conference
16-17th Mar, 2023

Conference, in-person (Bangalore)
Data Engineering Summit (DES) 2023
27-28th Apr, 2023

Conference, in-person (Bangalore)
MachineCon 2023
23rd Jun, 2023

3 Ways to Join our Community

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Telegram Channel

Discover special offers, top stories, upcoming events, and more.

Subscribe to our newsletter

Get the latest updates from AIM