plotly.figure_factory.create_bullet

plotly.figure_factory.create_bullet(data, markers=None, measures=None, ranges=None, subtitles=None, titles=None, orientation='h', range_colors='rgb(200, 200, 200)', 'rgb(245, 245, 245)', measure_colors='rgb(31, 119, 180)', 'rgb(176, 196, 221)', horizontal_spacing=None, vertical_spacing=None, scatter_options={}, **layout_options)

deprecated, use instead the plotly.graph_objects trace plotly.graph_objects.Indicator.

Parameters
  • | list | tuple) data ((pd.DataFrame) – either a list/tuple of dictionaries or a pandas DataFrame.

  • markers ((str)) – the column name or dictionary key for the markers in each subplot.

  • measures ((str)) – the column name or dictionary key for the measure bars in each subplot. 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 ((str)) – the column name or dictionary key for the qualitative ranges of performance, usually a 3-item list [bad, okay, good]. They correspond to the grey bars in the background of each chart.

  • subtitles ((str)) – the column name or dictionary key for the subtitle of each subplot chart. The subplots are displayed right underneath each title.

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

  • orientation ((bool)) – if ‘h’, the bars are placed horizontally as rows. If ‘v’ the bars are placed vertically in the chart.

  • range_colors ((list)) – a tuple of two colors between which all the rectangles for the range are drawn. These rectangles are meant to be qualitative indicators against which the marker and measure bars are compared. Default=(‘rgb(200, 200, 200)’, ‘rgb(245, 245, 245)’)

  • measure_colors ((list)) – a tuple of two colors which is used to color the thin quantitative bars in the bullet chart. Default=(‘rgb(31, 119, 180)’, ‘rgb(176, 196, 221)’)

  • horizontal_spacing ((float)) – see the ‘horizontal_spacing’ param in plotly.tools.make_subplots. Ranges between 0 and 1.

  • vertical_spacing ((float)) – see the ‘vertical_spacing’ param in plotly.tools.make_subplots. Ranges between 0 and 1.

  • scatter_options ((dict)) – describes attributes for the scatter trace in each subplot such as name and marker size. Call help(plotly.graph_objects.Scatter) for more information on valid params.

  • layout_options – describes attributes for the layout of the figure such as title, height and width. Call help(plotly.graph_objects.Layout) for more information on valid params.

Example 1: Use a Dictionary

>>> 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', subtitles='sublabel', markers='point',
...     measures='performance', ranges='range', orientation='h',
...     title='my simple bullet chart'
... )
>>> fig.show()

Example 2: Use a DataFrame with Custom Colors

>>> import plotly.figure_factory as ff
>>> import pandas as pd
>>> data = pd.read_json('https://cdn.rawgit.com/plotly/datasets/master/BulletData.json')
>>> fig = ff.create_bullet(
...     data, titles='title', markers='markers', measures='measures',
...     orientation='v', measure_colors=['rgb(14, 52, 75)', 'rgb(31, 141, 127)'],
...     scatter_options={'marker': {'symbol': 'circle'}}, width=700)
>>> fig.show()