2018年1月22日 星期一

畫多條線

源自於
http://onionys.blogspot.tw/2012/01/python-matplotlib.html

如果不想畫線而想畫點的話(改變line style),就在把 plt.plot(x,y) 這一行的引數多加"o",變成下面這行: plt.plot(x,y,"o")
當然還有很多其他的style可選,像是"ro"就是紅點,"--" 會是虛線, "r--" 就是紅色虛線。

import matplotlib.pyplot as plt
import numpy as np

x1 = np.arange(0,360,1)
y1 = np.sin(x1 * np.pi / 180.0)

x2 = x1
y2 = np.cos(x2 * np.pi / 180.0)

x3 = x1
y3 = np.tan(x3 * np.pi / 180.0)

plt.plot(x1,y1,lw=1)
plt.plot(x2,y2,"ro")
plt.plot(x3,y3,"y--",lw=3)

plt.ylabel("y_label")
plt.xlabel("x_label")
plt.title("Title")

plt.xlim(-30,390)
plt.ylim(-5,5)

plt.show()



沒有留言:

張貼留言

2024年4月24日 星期三 Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --2

 2024年4月24日 星期三 Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --2 AngularJS 實例 <!DOCTYPE html> <html> <head> &...