Hello,
I am working with the dataframe outlined in code at the base and I want to create a sunburst diagram.
One of the main issues I am facing, is when i read the document, the composition of the diagam does not change. Firstly, when I am trying to change the font colour, with the code below, it only changes the parent in the centre. I also want to change the font type, but it seems the fonts all around are driven dynamically.
ideally I am just wanting some help on control- I would like the following:
- To remove text within the graph and have it as a key legend only
- To be able to make all fonts the same colour
- To be able to edit the labels, so I can choose the information
fig.update_layout(
font_family=โHelveticaโ,
font_color=โblueโ,
font_size= 16,
#title_font_family=โTimes New Romanโ,
#title_font_color=โredโ,
#legend_title_font_color=โgreenโ
import pandas as pd
df = pd.DataFrame({
'ELEMENT TYPE': ['ALUMINIUM WINDOW', 'GLAZING', 'CLADDING', 'CLADDING', 'UHPC', 'UHPC', 'UHPC', 'INSULATION', 'INSULATION', 'INTERNAL DRYLINING', 'DRYLINING SECONDARY SUPPORT', 'SHEET FIRE STOP', 'ALUMINIUM WINDOW MIDDLE TRANSOM'],
'MATERIAL IMPACT': [1.577582, 21.120627, 2.471411, 4.444310, 10.104659, 5.150296, 18.171092, 4.671738, 3.114492, 1.078349, 2.802458, 3.195009, 7.343713],
'MATERIAL TYPE': ['ALUMINIUM', 'GLASS', 'TERRACOTTA', 'TERRACOTTA', 'UHPC', 'UHPC', 'UHPC', 'ROCKWOOL', 'ROCKWOOL', 'PLASTERBOARD', 'ALUMINIUM', 'GALVANIZED STEEL', 'ALUMINIUM'],
'MATERIAL': ['ANALYSIS_FRAMEFIXEDCL', 'ANALYSIS_GLAZING', 'ANALYSIS_ALU', 'ANALYSIS_UHPC', 'ANALYSIS_ALU', 'ANALYSIS_INTFINISH_0.4', 'ANALYSIS_UHPC', 'ANALYSIS_INTFINISH_0.6', 'ANALYSIS_INTFINISH_0.4', 'ANALYSIS_INTFINISH_0.6', 'ANALYSIS_INTFINISH_0.6', 'ANALYSIS_INTFINISH_0.4', 'ANALYSIS_FRAMECL'],
'Parent': ['85.25','85.25','85.25','85.25','85.25','85.25','85.25','85.25','85.25','85.25','85.25','85.25','85.25']
})
fig = px.sunburst(Final_df, path=["Parent", "MATERIAL TYPE", "ELEMENT TYPE", "MATERIAL"], values = "MATERIAL IMPACT",
width = 1500, height =1000,
# https://plotly.com/python/discrete-color/
#color_discrete_sequence= px.colors.qualitative.Pastel2,
# https://plotly.com/python/builtin-colorscales/
color_discrete_sequence= px.colors.sequential.Sunsetdark,
#color= "MATERIAL TYPE",
#color_continuous_scale="Greens",
hover_data=["MATERIAL IMPACT"],
fig.show()