Python Forum

Full Version: Python Matplotlib: Create chart for every 4 columns in Excel file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I want to loop through every 4 columns in an Excel file and create line charts in a pdf file.

There is no upload function for me to show my Excel file as sample.

Basically create 4 lines in a single chart for Column B-E, another 4 lines in a 2nd single chart for Column F-I.
Column A will be the date, or x-axis in the charts

The excel file could have many set of 4 columns, so the code must loop through all of them and create all the charts in a single pdf file (1 chart per page).

How do I do so?

THank you
go to pypi.org and search for the packages that you will need to complete.
--------------------
for excel, visit: https://pypi.org/search/?q=excel

There are also published guides available (which may or may not be biased) for example, for excel
see: https://www.python-excel.org/

openpyxl is a good choice: https://pypi.org/project/openpyxl/

--------------------
For PDF, there are again many packages available
visit: https://pypi.org/search/?q=pdf&o=

Report Lab: https://www.reportlab.com/opensource/
is praised as being an excellent choice (my experience is limited, so refrain from adding my opinion)
Hi

I want to use Mathplotlib for it. Basically, it should loop through every 4 columns in my Excel file and create a separate graph for every 4 column

Every 4 columns will be the Revenue, Cost, Wage and Profit for a firm. The graph for each firm will have the 4 lines for Revenue, Cost, Wage and Profit

Thank you