0

i wrote this code to generate a plot from a few different csv files:

import pandas as pd
import os
import matplotlib.pyplot as plt
import numpy


df1 = pd.read_csv(file1.csv, skiprows=7, parse_dates=['Time Stamp'])
df2 = pd.read_csv(file2.csv, skiprows=7, parse_dates=['Time Stamp'])
df3 = pd.read_csv(file3.csv, skiprows=7, parse_dates=['Time Stamp'])
result_path = r"C:\path"

time1 = df1["Time Stamp"]
power1 = df1[' Power (dBm)'].to_numpy()

time2 = df2["Time Stamp"]
power2 = df2[' Power (dBm)'].to_numpy()

time3 = df3["Time Stamp"]
power3 = df3[' Power (dBm)'].to_numpy()

fig = plt.figure(figsize=(60, 20))
plt.grid(True)
plt.xlim(left=500, right=1600)
plt.ylim(bottom=43.8, top=44.1)
plt.xlabel("Time (s)", size=50)
plt.ylabel("Power (dBm)", size=50)
plt.scatter(time1, power1, color='green', label='504', linewidth=4)
plt.scatter(time2, power2, color='red', label='505', linewidth=4)
plt.scatter(time3, power3, color='blue', label='506', linewidth=4)
plt.legend(loc=3, prop={'size': 30}, markerscale=5)
plt.xticks(color='k', size=50)
plt.yticks(color='k', size=50)
os.makedirs(result_path, exist_ok=True)
imageFileName = os.path.join(result_path, 'plot.png')
if os.path.isfile(imageFileName):
    os.remove(imageFileName)
plt.savefig(imageFileName)
plt.close(fig)

what i get after running it is :plot

i don't understand why it doesn't show the 2 other plots and why the x axis is a mess.

any suggestions?

thank you

0 Answers0