In the following snippet a tuple is provided to the explode parameter of the pie() function. The above example made only one of the wedges of a pie chart to explode out. Making multiple wedges of a pie chart to explode: Only the first element of the tuple is mentioned a fraction while all other elements are zero, which will make only the first wedge of the pie chart to look apart from the rest of the chart. In the above snippet the pie() function is passed with a tuple for the explode argument. Otherwise matplotlib will raise an exception of type ValueError. The length of the tuple should be equal to the number of pies in the pie chart. Making a wedge in a pie chart to explode:Ī wedge of a pie chart can be made to explode from the rest of the wedges of the pie chart using the explode parameter of the pie function.Įxplode is a tuple where each element corresponds to a wedge of the pie chart. # Aspect ratio - equal means pie is a circle PopulationShare = įigureObject, axesObject = plotter.subplots() PieLabels = 'Asia', 'Africa', 'Europe', 'North America', 'South America', 'Australia' # The slice names of a population distribution pie chart The below python code example draws a pie chart using the pie() function.īy default the pie() fucntion of pyplot arranges the pies or wedges in a pie chart in counter clockwise direction. Pie charts can be drawn using the function pie() in the pyplot module.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |