Python
使用turtle库
```python
import turtle
def draw_heart():
turtle.penup()
turtle.goto(0, -100)
turtle.pendown()
turtle.color('red')
turtle.begin_fill()
turtle.setheading(150)
turtle.circle(200, 90)
turtle.left(90)
turtle.circle(200, 90)
turtle.end_fill()
turtle.hideturtle()
turtle.done()
```
使用matplotlib库
```python
import numpy as np
import matplotlib.pyplot as plt
t = np.linspace(0, 2 * np.pi, 1000)
x = 16 * np.sin(t)3 y = 13 * np.cos(t) - 5 * np.cos(2*t) - 2 * np.cos(3*t) - np.cos(4*t) plt.figure(figsize=(8, 6)) plt.plot(x, y, color='red') plt.fill(x, y, color='red', alpha=0.6) plt.title('Python', fontsize=18) plt.axis('equal') plt.grid(True) plt.show() ``` JavaScript 使用HTML5 Canvas
```html