Einträge in der Legende verhindern
05 August, 2016
Mit dem Eintrag '_nologend_' kann man mit der Python Matplotlib verhindern, dass ein Plot in der Legende aufgeführt wird
import numpy as np
import matplotlib.pyplot as plt
x1,y1 = np.random.rand(2,10)
x2,y2 = np.random.rand(2,10)
x3,y3 = np.random.rand(2,10)
x4,y4 = np.random.rand(2,10)
plt.plot(x1, y1, label='Test 1')
plt.plot(x2, y2) #Kein Label, also auch nicht drin
plt.plot(x3, y3, label='_nolegend_') # Aktiv unterdrückt
plt.plot(x4, y4, label='Test 4')
plt.legend() # Legende mit Einträgen des ersten und vierten Plots