

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


import matplotlib.pyplot as plt
fig = plt.figure()
fig, ax = plt.subplots()
fig, ax = plt.subplots(2, 2)
ax.plot() # line graph ax.scatter() # scatter plot ax.bar() # bar chart ax.hist() # histogram ax.imshow() # image ax.pie() # pie chart
ax.set_title("Speed vs Time") ax.set_xlabel("Time (s)")
ax.set_ylabel("Speed (m/s)") ax.grid(True) ax.legend() ax.plot(x, y, color='red', linestyle='--', linewidth=2)
plt.plot(x, y)
plt.scatter(x, y)
plt.bar(categories, values)
plt.hist(values, bins=20)
plt.pie(values, labels=labels)
plt.imshow(data, cmap='hot')
plt.figure(figsize=(8, 6)) plt.figure(dpi=300) plt.savefig("plot.png")
fig, ax = plt.subplots() ax.plot(x, y) ax.set_title("Example") plt.show()
fig, ax = plt.subplots(2, 2) ax[0, 0].plot(x, y) ax[1, 1].scatter(a, b)
plt.style.use("seaborn-v0_8")