Open In App
Related Articles

plotly.figure_factory.create_bullet() in Python

Improve Article
Save Article
Like Article

Plotly library of Python can be very useful for data visualization and understanding the data simply and easily.


This method is used to create bullet charts. This function can take both dataframes or a sequence of dictionaries.

Syntax: plotly.figure_factory.create_bullet(data, markers=None, measures=None, ranges=None, subtitles=None, titles=None, orientation=’h’, **layout_options)


data: either a list/tuple of dictionaries or a pandas DataFrame.

markers: the column name or dictionary key for the markers in each subplot.

measures:  This bar usually represents the quantitative measure of performance, usually a list of two values [a, b] and are the blue bars in the foreground of each subplot by default.

ranges: This parameter is usually a 3-item list [bad, okay, good]. They correspond to the grey bars in the background of each chart.

subtitles: the column name or dictionary key for the subtitle of each subplot chart. 

titles ((str)) – the column name or dictionary key for the main label of each subplot chart.

Example 1: 


import plotly.figure_factory as ff
data = [
  {"label": "revenue"
   "sublabel": "us$, in thousands",
   "range": [150, 225, 300], 
   "performance": [220,270],
   "point": [250]},
  {"label": "Profit"
   "sublabel": "%"
   "range": [20, 25, 30],
   "performance": [21, 23], 
   "point": [26]},
  {"label": "Order Size"
   "sublabel":"US$, average",
   "range": [350, 500, 600],
   "performance": [100,320],
   "point": [550]},
  {"label": "New Customers"
   "sublabel": "count",
   "range": [1400, 2000, 2500],
   "performance": [1000, 1650],
   "point": [2100]},
  {"label": "Satisfaction"
   "sublabel": "out of 5",
   "range": [3.5, 4.25, 5],
   "performance": [3.2, 4.7],
   "point": [4.4]}
fig = ff.create_bullet(
    data, titles='label',
    title='my simple bullet chart'


Example 2: Using a Dataframe with colors


import plotly.figure_factory as ff
import pandas as pd
data = [
    {"title": "Revenue",
     "subtitle": "US$, in thousands",
     "ranges": [150, 225, 300],
     "measures":[220, 270],
    {"title": "Profit",
     "subtitle": "%",
     "ranges": [20, 25, 30],
     "measures":[21, 23],
    {"title": "Order Size",
     "subtitle": "US$, average"
     "ranges": [350, 500, 600],
     "measures":[100, 320],
    {"title": "New Customers"
     "subtitle": "count",
     "ranges": [1400, 2000, 2500],
     "measures":[1000, 1650], 
    {"title": "Satisfaction"
     "subtitle": "out of 5",
     "ranges": [3.5, 4.25, 5], 
     "measures":[3.2, 4.7],
fig = ff.create_bullet(
    data, titles='title'
    measure_colors=['rgb(14, 52, 75)', 'rgb(31, 141, 127)'],
    scatter_options={'marker': {'symbol': 'circle'}},


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 21 Jul, 2020
Like Article
Save Article
Similar Reads
Complete Tutorials