Skip to content
Related Articles

Related Articles

Funnel Chart in Pygal
  • Last Updated : 28 Jul, 2020

Pygal is a Python module that is mainly used to build SVG (Scalar Vector Graphics) graphs and charts. SVG is a vector-based graphics in the XML format that can be edited in any editor. Pygal can create graphs with minimal lines of code that can be easy to understand and write.

Funnel in Pygal

Funnel charts are those type of charts which are often used to represent various stages mainly in sales and service process and allows to show the amount of revenue for each of the stages. This chart is much beneficial for identifying potential errors in organization sales and service progress. The funnel chart is similar to the stacked bar chart. The funnel chart helps to summarize data and to track sales conversion and retention rates. And moreover, it can be used to track the success of a business strategy. It can be created using the Funnel() method.

Syntax:

funnel_chart = pygal.Funnel()

Example 1:




# importing pygal
import pygal
  
# creating the chart object
funnel = pygal.Funnel()
  
# naming the title
funnel.title = 'Funnel'        
  
# Random data
funnel.add('A', [26, 22, 39, 39, 32, 30, 33, 24, 24, 30])
funnel.add('B', [31, 40, None, None, None, None, 40, 32, 25, 31])
funnel.add('C', [37, 27, 31, 20, None, 32, 24, 39, 29, 22])
funnel.add('D', [38, None, 20, 29, 33, 23, 32, 33, 32, 23])
  
funnel

Output:



Example 2:




# importing pygal
import pygal
import numpy
  
  
# creating the chart object
funnel = pygal.Funnel()
  
# naming the title
funnel.title = 'Funnel'        
  
# Random data
funnel.add('A', numpy.random.rand(10))
funnel.add('B', numpy.random.rand(10))
funnel.add('C', numpy.random.rand(10))
funnel.add('D', numpy.random.rand(10))
  
funnel

Output:

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
Recommended Articles
Page :