Setting Colors

 

The color of pie can be change in plotly module. Different colors help in to distinguish the data from each other, which help  to understand the data more efficiently.

 

Example:

 

Python3




import plotly.express as px
 
# Loading the iris dataset
df = px.data.iris()
 
fig = px.pie(df, values="sepal_width",
             names="species",
             color_discrete_sequence=px.colors.sequential.RdBu)
fig.show()


 

 

Output:

 

 



Pie plot using Plotly in Python

Plotly is a Python library which is used to design graphs, especially interactive graphs. It can plot various graphs and charts like histogram, barplot, boxplot, spreadplot and many more. It is mainly used in data analysis as well as financial analysis. plotly is an interactive visualization library. 

Similar Reads

Pie Plot

A pie chart is a circular analytical chart, which is divided into region to symbolize numerical percentage. In px.pie, data anticipated by the sectors of the pie to set the values. All  sector  are classify in names. Pie chart is used usually to show the percentage with next corresponding slice of pie. Pie chart helps to make understand well because of its different portions and color codings....

Grouping Data

...

Customizing pie chart

...

Setting Colors

...