Programming/python(파이썬)
pyplot
구차니
2023. 10. 4. 21:58
하나의 그래프에 여러개의 데이터를 한번에 그리기
import matplotlib.pyplot as plt import numpy as np # create data x = [1,2,3,4,5] y = [3,3,3,3,3] # plot lines plt.plot(x, y, label = "line 1", linestyle="-") plt.plot(y, x, label = "line 2", linestyle="--") plt.plot(x, np.sin(x), label = "curve 1", linestyle="-.") plt.plot(x, np.cos(x), label = "curve 2", linestyle=":") plt.legend() plt.show() |
[링크 : https://www.geeksforgeeks.org/plot-multiple-lines-in-matplotlib/]