Refer to this short article to create a Sunburst chart in Excel using Python. Programming steps are given along with the IDE settings and a sample code to create a Sunburst chart using Python. The given sample code adds hierarchical data in the sheet for demonstrating the feature without any additional activity.
Steps to Create Sunburst Chart in Excel using Python
- Set the IDE to use Aspose.Cells for Python via Java for creating a Sunburst chart
- Import required classes, start JVM, and load or create a Workbook
- Access the target sheet, set its name, and insert data if it is not present in the sheet
- Get the charts collection, insert a SUNBURST chart, and set its title
- Customize the data series, category hierarchy, title, and style of the chart
- Set the format, foreground color, legend position, and style
- Save the output Excel file with a Sunburst chart
These steps describe the development of a Sunburst chart creator using Python. Import library classes, start JVM, create a Workbook, access the target sheet, and sample data if it does not exist in the sheet. Create a SUNBURST chart, set the title, add series and categories, and set chart style before saving the output Excel file.
Code to Create Sunburst Chart using Python
The given sample code demonstrates the Sunburst chart creation by using the hierarchical data in the Excel file. The data should be properly entered as string data creates empty chart if series data is string instead of integer or float. You may set the chart style in Excel for making the chart more visible and clearer if required.
This article has introduced the code for a Sunburst chart generator. To find and replace text in an Excel file, refer to the article Find and replace text in Excel using Python.