Python Forum
Python Matplotlib: Create chart for every 4 columns in Excel file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Matplotlib: Create chart for every 4 columns in Excel file
#1
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
Reply
#2
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)
Reply
#3
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Verification of an excel file saleenahohn 2 166 Jul-09-2021, 06:56 AM
Last Post: Larz60+
  Read and write active Excel file euras 4 372 Jun-29-2021, 11:16 PM
Last Post: Pedroski55
  Open an excel file Newbie1114 1 344 Jun-16-2021, 09:11 PM
Last Post: Gribouillis
  [Solved] Using readlines to read data file and sum columns Laplace12 4 316 Jun-16-2021, 12:46 PM
Last Post: Laplace12
  Create ZIP file not working using ZipFile? korenron 1 275 Jun-13-2021, 04:15 PM
Last Post: korenron
  How to save Matplot chart to temp file? Morkus 2 353 Jun-12-2021, 10:52 AM
Last Post: Morkus
  problem with pyinstaller to create an executable file atlass218 0 413 May-15-2021, 11:01 AM
Last Post: atlass218
  Filter Excel and Convert an Excel File giddyhead 0 417 May-13-2021, 06:31 PM
Last Post: giddyhead
  Problems with inserting images into an Excel File FightingFarmer 2 467 May-12-2021, 10:03 PM
Last Post: FightingFarmer
  Create SQLite columns from a list or tuple? snakes 6 805 May-04-2021, 12:06 PM
Last Post: snakes

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020