PYTHON Tutorial
plt.plot()
function to plot the line, specifying the x and y values.plt.scatter()
function to plot the points, specifying the x and y coordinates.plt.title()
, plt.xlabel()
, plt.ylabel()
, and plt.legend()
.plt.figure()
and plt.gca()
.color
, linewidth
, and marker
arguments in the plt.plot()
function.import matplotlib.pyplot as plt
# Plot a line
plt.plot([1, 2, 3], [4, 5, 6])
plt.title("Line Plot")
plt.xlabel("X Axis")
plt.ylabel("Y Axis")
# Plot points
plt.scatter([1, 3, 5], [7, 9, 11])
plt.title("Scatter Plot")
plt.xlabel("X Axis")
plt.ylabel("Y Axis")
# Customize the plot
plt.figure(figsize=(5, 5))
plt.grid(True)
plt.legend(["Line", "Points"])
plt.show()