Hinweise für Python-Anfänger. Bitte seien Sie vorsichtig mit Fehlern im Inhalt.
import matplotlib.pyplot as plt
import numpy as np
def test():
    x = np.array([1,2,3,4,5])
    y = np.array([1,2,3,4,5])
    
    plt.plot(x, y, 'o', label="x and y")
    plt.legend()
    plt.show()
    
    plt.plot(x, y, 'o', label="x and y")
plt.legend (numpoints = 1) # setze numpoints auf 1 plt.show()
if __name__ == '__main__':
    test()
Before:
 
After:
 
        Recommended Posts