Seite 1 von 1

Plotten

Verfasst: Freitag 3. April 2015, 00:20
von TurbineWelt
Mein Frage ist über ein Fehler: values = values[:, 2] NICHT RICHTIG! VIEL INDIZES sagt es....
(ICH BIN SEHR BEGINEER)

Code: Alles auswählen

values = np.genfromtxt(StringIO(csv_data), delimiter = ",")
values = values[:, 2]

stupidArray = [50, 100, 200, 300, 400]
master_results = []

for i, v in enumerate(values):
    master_results.append(master_func(v, stupidArray))

temp_array1 = []
temp_array2 = []
temp_array3 = []
temp_array4 = []
temp_array5 = []

for i in master_results:
    print i
    temp_array[0] = 1
    print temp_array[0]
    temp_array[1].append(i[1])
    temp_array[2].append(i[2])
    temp_array[3].append(i[3])
    temp_array[4].append(i[4])
    
for i in temp_array:
    plt.plot(i[0])
    plt.plot(i[1])
    plt.plot(i[2])
    plt.plot(i[3])
    plt.plot(i[4])

plt.ylabel('some numbers')
plt.show()

Re: Ploten

Verfasst: Freitag 3. April 2015, 10:08
von Sirius3
@TurbineWelt: Dann wird wohl csv_data nur eine Spalte enthalten. Der Rest vom Code enthält auch noch Fehler und wenn man numpy benutzt würde man das auch nicht so kompliziert schreiben, weil numpy-Arrays die Indizierung von ganzen Spalten und Zeilen erlaubt.