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.