python - Plotting with lines connecting points -


i'm creating program determine minimum, maximum, , percentiles of winds @ heights. file split 5 columns. code far looks this:

import matplotlib.pyplot plt f = open('wind.txt', 'r') line in f.readlines():     line = line.strip()     columns = line.split()     z = columns[0]     u_min = columns[1]     u_10 = columns[2]     u_max = columns[4]     u_90 = columns[3]      plt.plot(u_min,z,'-o')     plt.plot(u_max,z,'-o') 

this shows max , mins of windplt.show()

as can see it's plotting each min , max @ specific altitude dot. how can adjust makes line instead.

edited answer due comment

to create line connects min values:

  1. store min values in list (using append)
  2. plot list

the code:

import matplotlib.pyplot plt f = open('wind.txt', 'r') min_vector = [] max_vector = [] z_vector = [] line in f.readlines():     line = line.strip()     columns = line.split()     z = columns[0]     u_min = columns[1]     u_10 = columns[2]     u_max = columns[4]     u_90 = columns[3]      min_vector.append(u_min)     max_vector.append(u_max)     z_vector.append(z)  plt.plot(min_vector, z_vector, '-o') plt.plot(max_vector, z_vector, '-o') 

Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -