Linked Questions

Popular Questions

I am trying to plot this data set. The data set is an array produced from a list. Where if the item in the 2nd index (of a list) is a certain string, then it will plot the 0th index (x) by the 3rd index (y). And then all of the coordinates that have the same string in it's 2nd index will all be a certain color.

So basically i have a plot, of the flight vs a value for 5 different receivers. Each receiver has a different color, all using the same y range

Now im able to produce this plot, however my issue is, is that when i plot it, its almost as if im plotting 5 individual plots on one plot, because it plots the first receivers x,y at the bottom, and then the next receiver it plots x, y right above the first as if its has a whole new y range, and so on for the rest of the receivers.

Ive tried using y_lim(0,1000000), but that just produces a plot all scrunched in at the bottom, even though one of my values is upwards of 900000. And even if i change it to a much lower max number it is still all scrunched up at the bottom

im also able to change the array into a list and plot it, which gives me the correct y range that im looking for, but now it won't color the different receivers.

These are the values in CSFlistremote:
[['TF01', '311', '2EAP', '763243', 'Cycle Slip Frequency'], ['TF01', '311', '3EAP', '763540', 'Cycle Slip Frequency'], ['TF01', '311', 'j078', '217278', 'Cycle Slip Frequency'], ['TF01', '311', 'j080', '271626', 'Cycle Slip Frequency'], ['TF01', '311', 'j524', '217289', 'Cycle Slip Frequency'], ['TF02', '311', '2EAP', '178616', 'Cycle Slip Frequency'], ['TF02', '311', '3EAP', '218762', 'Cycle Slip Frequency'], ['TF02', '311', 'j078', '269259', 'Cycle Slip Frequency'], ['TF02', '311', 'j080', '195869', 'Cycle Slip Frequency'], ['TF02', '311', 'j524', '239231', 'Cycle Slip Frequency'], ['TF03', '031', '2EAP', '828854', 'Cycle Slip Frequency'], ['TF03', '031', '3EAP', '690723', 'Cycle Slip Frequency'], ['TF03', '031', 'j078', '942357', 'Cycle Slip Frequency'], ['TF03', '031', 'j080', '942057', 'Cycle Slip Frequency'], ['TF03', '031', 'j524', '942066', 'Cycle Slip Frequency']]

These are the values in recvs:
['j078', 'j080', 'j524', '2EAP', '3EAP']

import numpy as np
import matplotlib.pyplot as plt

fig, ax = plt.subplots()
for recv in recvs:      
    if len([x for x in CSFlistremote if x[2] == recv]) > 0:
        freq = np.array([[str(x[0]),int(x[3])] for x in CSFlistremote if 'Cycle Slip Frequency' in x[4] and recv in x[2]])
        ax = plt.axes()
        ax.plot(freq[:,0],freq[:,1],'o--', linewidth=2, markersize=6, label = recv) 
        plt.title('Remote Receivers Cycle Slip Frequency')
        ax.set_ylabel('Observations/Slip')
        ax.set_xlabel('Flight')
        ax.legend(bbox_to_anchor=(0.79,0.97), loc=2, borderaxespad=0.)
plt.show()

The plot that i get from this are 5 different lines all with the correct different receiver color, however it plots the first receivers x,y at the bottom, and then the next receiver it plots x, y right above the first as if its has a whole new y range, and so on for the rest of the receivers. So instead of it all being on my y-range plot, its as if it 5 different plots on one plot.

Related Questions