Matplotlib color chart
Here is the color chart for using inside matplotlib
Image gotten from a discussion on stack: https://stackoverflow.com/questions/22408237/named-colors-in-matplotlib
Here is the color chart for using inside matplotlib
Image gotten from a discussion on stack: https://stackoverflow.com/questions/22408237/named-colors-in-matplotlib
Nay ngồi xem lại phương trình tham số (parametric equation), vọc một tí với plot trong python.
Phương trình tham số là phương trình mà nghiệm được biểu diễn bởi một số (tham số) bên ngoài, ví dụ nghiệm x,y sẽ được biểu diễn bởi x = f(t) và y =g(t).
Phương trình tham số của đường con bướm được biểu diễn như sau:
Đồ thị nó sẽ ra như thế này:
Code python để plot như sau:
# the butterfly curve from __future__ import division import numpy as np, math, os, scipy import matplotlib.pyplot as plt #t_range = np.arange(0,12*math.pi,0.001) t_range = np.linspace(0,12*math.pi,1000) for t in t_range: x = math.sin(t)*(math.exp(math.cos(t))-2*math.cos(4*t)-(math.sin(t/12))**5) y = math.cos(t)*(math.exp(math.cos(t))-2*math.cos(4*t)-(math.sin(t/12))**5) plt.scatter(x,y,marker='.',s=0.2,c='k') plt.show()