tomzko tomzko - 4 months ago 36
Python Question

Plot or reshape 2D array matplotlib

i have no idea how can i plot scatter with a 2D array of this type:


the plot should be x vs t, maybe instead of doing this with a maplotlib routine be able to reshape a to obtain:




Assuming your data starts in the format a = [[x0, t0]]:

Split x & t into separate lists, then you can pass them into matplotlib.

import matplotlib.pyplot as plt
x = [i[0] for i in a]
t = [i[1] for i in a]
plt.plot(x, t)