python - Adding a legend to a plot of a list -
i'm not sure how add legend set of data . i've tried few online guides none seem of help.
l_list = np.linspace(0, 500, 6) #kg plt.hold(true) theta = 84 print("begin simulation...") print() in l_list: print("mass = ", i, "kgs") x, y, t = flightenvelope(i, theta) #t, m, t = flightenvelope(l, i) plt.plot(x,y) print() print("simulation complete.") print() print("=============================================================") print("=============================================================") plt.ylabel("height of rocket (m)") plt.xlabel("horizontal distance traveled (m)") plt.title("trajectory of rocket") plt.grid(true) plt.show()
just use:
plt.legend(["a", "b", "c"])
Comments
Post a Comment