Python Forum
Python v MatLab for graphs and plots - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Python v MatLab for graphs and plots (/thread-26138.html)



Python v MatLab for graphs and plots - CynthiaMoore - Apr-22-2020

I need to generate some graphs of data from an Excel sheet. I installed a trial version of MatLab and played with it a bit. It can certainly do what I need.

Then a friend said I should use Python instead. He had not used it for graphing, but had heard that it had library functions especially for graphing. So before I spend a lot of money to buy MatLab, I thought I ask here about graphing with Python.

Here's a graph that I produced with a very old shareware graphing program. The data is blood glucose readings for a diabetic. Then I used a graphics program to add the shading. The green areas are good readings, the red are not so good.

[Image: Sample%20Graph%203%20periods%20new.jpg?dl=0]

How difficult would it be for me to learn enough Python to generate a graph like this?

And where would I go to read up on how?

And does anyone have experience with both Python and MatLab and can give their opinion on which would be better?

Thanks for any help and any pointers.


RE: Python v MatLab for graphs and plots - ndc85430 - Apr-22-2020

Two libraries to look at are Matplotlib and Seaborn. Python and these libraries are widely used in academia, like MATLAB is, so producing high quality, complex plots isn't a problem.


RE: Python v MatLab for graphs and plots - CynthiaMoore - Apr-22-2020

(Apr-22-2020, 11:46 AM)ndc85430 Wrote: Two libraries to look at are Matplotlib and Seaborn. Python and these libraries are widely used in academia, like MATLAB is, so producing high quality, complex plots isn't a problem.

Thanks, Minister, that is exactly what I was looking for. It looks like I have a lot of reading to do.


RE: Python v MatLab for graphs and plots - snippsat - Apr-22-2020

(Apr-22-2020, 01:16 PM)CynthiaMoore Wrote: I need to generate some graphs of data from an Excel sheet.
For this in Python is Pandas useful.
import pandas as pd

df = pd.read_excel('file_example.xlsx')
Also is easier to plot and do stuff if use Jupyter Notebook.

Can also do this online with no installation eg trough Google Colab.
Here is a demo of doing this with Pandas in a Notebook,some cleaning up like Date.
Then can plot,can also trow in Altair.
Here is the NoteBook

So all i have done here is with no installation,libraries as mention @ndc85430 is all pre-installed.
Pandas uses matplotlib internally when do plot,as you see i don't need to import it.


RE: Python v MatLab for graphs and plots - CynthiaMoore - Apr-22-2020

Thanks, snippsat, I will check into all of that. It looks like there are plenty of tools for what I need to do.