Plot switches horizontally when channel changes and vertically when antenna changes.
I am unable to switch the plots after plotting for a one plot e.g. 1,1 in matrix. The same data is fetched for the row and I end up getting undesired result.
i = 0
for antenna in antennas:
ant = antenna[0]
for channel in channels:
channela = channel[0]
query_test_run = "SELECT TestRunID FROM TestRuns WHERE DutID = '%s' and Rate = '%s' and Mode = '%s' and Band = '%s' and BandWidth = '%s' and Channel = '%s' and Antenna = '%s' " %(select_dut,select_rate,select_mode,select_band,select_bw,channela,ant)
cursor.execute(query_test_run)
test_run = cursor.fetchall()
print(test_run)
for run in test_run:
tstrun = run[0]
final_query = "SELECT tx.Set_Power,tx.EVM,tx.TX_Power from TXEVM as tx, TestRuns as t, DUTs as d, APModels as a WHERE d.ModelID = a.ModelID and tx.TestRunID = t.TestRunID and t.DUTID = d.DUTID and tx.TestRunID = '%s' ORDER BY d.Serial_Number, tx.Set_Power ASC" %(tstrun)
cursor.execute(final_query)
data = cursor.fetchall()
if data != []:
print(data,antenna,channel,run)
fig, ax = plt.subplots(nrows=1, ncols=len(channels),figsize=(30,5.5))
df = pd.DataFrame( [[ij for ij in i] for i in data] )
df.rename(columns={0: 'Set_Power', 1: 'EVM', 2: 'TX_Power'}, inplace=True);
for i in range(len(channels)):
for row in data:
row = ax[i]
channel = channels[i]
x = df['TX_Power']
y = df['EVM']
row.plot(x,y)