Ich möchte etwas plotten, aber die Ausgabe ist nicht wie ich es mir wünsche. Ich möchte die roten Linien wie auf meinem Bild und ich fand keine Diskussion in der Dokumentation.Matplotlib: Fehlerbalken fehlende Zeile
import matplotlib.pyplot as plt
import math
import numpy as np
fig, ax = plt.subplots()
files = ['N30.dat', 'N40.dat', 'N50.dat', 'N60.dat', 'N70.dat', 'N80.dat']
N = 30
plot_list_x = []
plot_list_y = []
for fname in files:
data = np.loadtxt(fname)
x = [1 for _ in range(10)]
N += 10
# mean
mean = data.mean()
plt.plot(N, mean, '.')
plot_list_x.append(N)
plot_list_y.append(mean)
# standard derivation
sd = 0
for i in data:
sd += math.pow(i - mean, 2)
sd = math.sqrt(sd/(N-1))
# standard error
se = sd/math.sqrt(N)
plt.errorbar(N, mean, yerr=sd, fmt='_', ecolor='g', capthick=2)
plt.plot(plot_list_x, plot_list_y, 'g-')
plt.xticks([20, 30, 40, 50, 60, 70, 80, 90, 100])
plt.yticks([0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
ax.set_title('Airline Streaming')
ax.set_xlabel('count of clients')
ax.set_ylabel('packet loss')
plt.show()
Ich möchte das, aber ich habe das Bild ohne die roten Linien.
['kentern'] (https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.errorbar.html#matplotlib-axes-axes-errorbar) – Goyo