gistlib
Here's an example code to draw a beaver using matplotlib library in Python:
matplotlib
main.pyimport matplotlib.pyplot as plt fig, ax = plt.subplots() # draw head circle1 = plt.Circle((0, 0), 1, color='brown') ax.add_artist(circle1) # draw nose circle2 = plt.Circle((0.3, 0.3), 0.2, color='black') ax.add_artist(circle2) # draw eyes circle3 = plt.Circle((0.5, 0.5), 0.05, color='white') ax.add_artist(circle3) circle4 = plt.Circle((0.5, 0.5), 0.02, color='black') ax.add_artist(circle4) # draw teeth teeth = plt.Rectangle((-0.5, -0.2), 1, 0.2, color='white') ax.add_artist(teeth) # draw tail x = [1, 3, 3, 1] y = [0, 0, -1, -1] tail = plt.Polygon(list(zip(x, y)), color='brown') ax.add_artist(tail) plt.axis('equal') plt.show() 641 chars31 lines
import matplotlib.pyplot as plt fig, ax = plt.subplots() # draw head circle1 = plt.Circle((0, 0), 1, color='brown') ax.add_artist(circle1) # draw nose circle2 = plt.Circle((0.3, 0.3), 0.2, color='black') ax.add_artist(circle2) # draw eyes circle3 = plt.Circle((0.5, 0.5), 0.05, color='white') ax.add_artist(circle3) circle4 = plt.Circle((0.5, 0.5), 0.02, color='black') ax.add_artist(circle4) # draw teeth teeth = plt.Rectangle((-0.5, -0.2), 1, 0.2, color='white') ax.add_artist(teeth) # draw tail x = [1, 3, 3, 1] y = [0, 0, -1, -1] tail = plt.Polygon(list(zip(x, y)), color='brown') ax.add_artist(tail) plt.axis('equal') plt.show()
This will create a simple visualization of a beaver using matplotlib.
Output:
gistlibby LogSnag