Customizing pie chart
The pie chart can be customized by using the px.pie, using some of its parameters such as hover_data and labels. Let’s see the below example for better understanding.
Example:
Python3
import plotly.express as px # Loading the iris dataset df = px.data.iris() fig = px.pie(df, values = "sepal_width" , names = "species" , title = 'Iris Dataset' , hover_data = [ 'sepal_length' ]) 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.