Plotting Doughnut Charts in Excel using XlsxWriter module:

Code 1: Plotting simple doughnut chart in python for data science.

To plot a simple doughnut chart on excel sheet, we use add_chart() method using type ‘doughnut’ keyword argument of workbook object.

Doughnut Chart in Excel XlsxWriter module in Python for Data ScienceDoughnut Chart in Excel XlsxWriter module in Python for Data Science

OUTPUT:

Doughnut Chart in Excel XlsxWriter module in Python for Data Science

Code 2: Plotting doughnut chart with user defined segment color

To plot a simple doughnut chart on excel sheet using user defined segment color, we use add_series() method using ‘points’ keyword argument of chart object.

OUTPUT:

Code 3: Plotting a Doughnut chart with rotation of segments

To plot a doughnut chart with rotation of segments on excel sheet, we use set_rotation() method with definite angle argument of chart object.

Doughnut Chart in Excel XlsxWriter module in Python for Data Science

OUTPUT:

Code 4: Plotting doughnut chart with user defined hole size

To plot a doughnut chart with user defined hole size, we use set_hole_size() method with definite value(radius) argument of chart object.

OUTPUT:

Doughnut Chart in Excel XlsxWriter module in Python for Data Science

So, to learn more about doughnut charts in python for data science, you can check this and this as well.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.