0

I'm developing a software that get data from Csv file and plot them in the Same chart using same X coordinates but different Y coordinates for each Signal.

The Csv file structured like that:

DateTime;S1;S2;S3
2020-07-15 08:55:25.409877;999.1321411760139;731.5787800868936;934.9127699585481
2020-07-15 08:55:25.416509;937.8423437386526;492.8973514443781;289.0147319623144

Datetime is the header of X coordinates and is the Time

S1,S2,etc.. are the headers of Y coordinates and are Signals Values

I want to read data from csv and plot a chart that has DateTime on X coordinates equals for each Signals, and for each time the chart has S1 Y coordinate for the first Datetime coordinate, S2 for the second Datetime.... and so on.

This is an example of Output: https://drive.google.com/file/d/1AIo1MzNEw_XeJ_PbcZsXSTGvHCYBVTYs/view?usp=sharing

Wes
  • 266
  • 1
  • 3
  • 13

1 Answers1

1

One way you could do that is through Pandas and Matplotlib

import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_csv('your_csv_file.csv', sep=';')

x_col  = 'DateTime'
y_cols = [col for col in df.columns if col != x_col]

plt.plot(df[x_col], df[y_cols])
plt.show()
Gabriel Milan
  • 702
  • 2
  • 7
  • 21
  • If you're running on a remote computer, it won't show locally. But you can use the [`plt.savefig`](https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.savefig.html) method for generating an image you could download. – Gabriel Milan Jul 15 '20 at 15:13
  • Or, if you have set X11 forwarding, you could try one of these methods: https://stackoverflow.com/questions/3453188/matplotlib-display-plot-on-a-remote-machine – Gabriel Milan Jul 15 '20 at 15:14