Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

plotly pie chart in pie chart

import plotly.graph_objs as go

labels = ['Oxygen','Hydrogen','Carbon_Dioxide','Nitrogen']
outer_values = [4500,2500,500]
inner_values = [500, 1000, 2000, 1000,
                 500, 1000, 1000,
                 200, 300]

common_props = dict(labels=labels,
                    values=values,)

trace1 = go.Pie(
    hole=0.5,
    sort=False,
    direction='clockwise',
    domain={'x': [0.15, 0.85], 'y': [0.15, 0.85]},
    values=inner_values,
    textinfo='label',
    textposition='inside',
    marker={'line': {'color': 'white', 'width': 1}}
)

trace2 = go.Pie(
    hole=0.7,
    sort=False,
    direction='clockwise',
    values=outer_values,
    labels=labels,
    textinfo='label',
    textposition='outside',
    marker={'colors': ['green', 'red', 'blue'],
            'line': {'color': 'white', 'width': 1}}
)

fig = go.FigureWidget(data=[trace1, trace2])
fig
Comment

PREVIOUS NEXT
Code Example
Python :: layer enable time arcpy 
Python :: Setting spacing between ticks in matplotlib 
Python :: python to make video 
Python :: python community 
Python :: python dictionary pop 
Python :: delete outliers in pandas 
Python :: hash with python 
Python :: make virtual environment wrapper python 3 
Python :: mapping with geopandas 
Python :: pandas add thousands separator 
Python :: python requests no certificate example 
Python :: python add strings 
Python :: how to filter queryset with foreign key in django 
Python :: image blur in python 
Python :: How to count a specific number in a python list? 
Python :: get file parent directory python 
Python :: numpy one hot 
Python :: reorder list python 
Python :: specific mail.search python UNSEEN SINCE T 
Python :: how to convert python to exe 
Python :: adding debugger in django code 
Python :: python all permutations of a string 
Python :: map function in python 
Python :: code coverage pytest as html 
Python :: python how to sum two lists 
Python :: python processpoolexecutor 
Python :: swap in python 
Python :: strip in split python 
Python :: how to automatically install python packages 
Python :: python sort list by custom function 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =