Python third-party library OPENPYXL (3)Area Map
An area chart is similar to a line chart, where the area below the drawing line is populated and different variants can be obtained by setting the grouping to "standard", "stacked", or "percentstacked". Standard "is the default.
Area Map
fromOpenpyxlImportWorkbook fromOpenpyxl.chartImport(AreaChart, Reference, Series,) WB=Workbook () WS=wb.activerows= [ [' Number','Batch 1','Batch 2'], [2, 40, 30], [3, 40, 25], [4, 50, 30], [5, 30, 10], [6, 25, 5], [7, 50, 10],] forRowinchrows:ws.append (ROW) chart=AreaChart () chart.title="Area Chart"Chart.style= 13Chart.x_axis.title='Test'Chart.y_axis.title='Percentage'Cats= Reference (WS, Min_col=1, Min_row=1, max_row=7) Data= Reference (WS, min_col=2, Min_row=1, max_col=3, max_row=7) chart.add_data (data, Titles_from_data=True) Chart.set_categories (cats) Ws.add_chart (chart,"A10") Wb.save ("area.xlsx")
Operation Result:
3D Area Map
fromOpenpyxlImportWorkbook fromOpenpyxl.chartImport(Areachart3d, Reference, Series,) WB=Workbook () WS=wb.activerows= [ [' Number','Batch 1','Batch 2'], [2, 30, 40], [3, 25, 40], [4, 30, 50], [5, 10, 30], [6, 5, 25], [7, 10, 50],] forRowinchrows:ws.append (ROW) chart=Areachart3d () chart.title="Area Chart"Chart.style= 13Chart.x_axis.title='Test'Chart.y_axis.title='Percentage'Chart.legend=Nonecats= Reference (WS, Min_col=1, Min_row=1, max_row=7) Data= Reference (WS, min_col=2, Min_row=1, max_col=3, max_row=7) chart.add_data (data, Titles_from_data=True) Chart.set_categories (cats) Ws.add_chart (chart,"A10") Wb.save ("area3d.xlsx")
Run Results
Python third-party library OPENPYXL (3)