Drawing a Circle with Squares Using Turtle
I recently discovered a very interesting Python drawing library called Turtle. Here, I’ll briefly explain the idea behind using the Turtle library to draw a circle with squares.……
春江暮客的个人学习分享网站
The butterfly curve, discovered by Temple H. Fay, is a beautiful curve that can be expressed using a polar coordinate function. Because of its elegance, I wanted to use it as my blog’s favicon.ico. Here, I’ll use Python’s matplotlib.pyplot package to draw the desired butterfly curve. First, let’s admire the beautiful butterfly curve.

It can also be expressed using spherical coordinates:
matplotlib.pyplot as the Plotting Tool in Pythonimport numpy as np
import matplotlib.pyplot as plt
t = np.arange(0.0, 12*np.pi, 0.01)
x = np.sin(t)*(np.e**np.cos(t) - 2*np.cos(4*t)-np.sin(t/12)**5)
y = np.cos(t)*(np.e**np.cos(t) - 2*np.cos(4*t)-np.sin(t/12)**5)
numpy functions with plt to draw the required imageplt.figure(figsize=(8,6))
plt.axis('off')
plt.plot(x,y,color='blue',linewidth = '2')
#plt.show()
plt.savefig("butter.jpg",dpi=400)

Pillow to resize the image to an appropriate size for a faviconfrom PIL import Image
im = Image.open("butter.jpg")
favicon = im.resize((50,50))
favicon.save("favicon.ico")
