import matplotlib.pyplot as plt # Sample data x = [1, 2, 3, 4, 5] y = [2, 3, 5, 7, 11]
# Create a line plot
plt.plot(x, y, marker='o', linestyle='-')
# Add labels and title
plt.xlabel('X-axis Label')
plt.ylabel('Y-axis Label')
plt.title('Example Plot')
# Show grid plt.grid(True) # Show the plot plt.show()

matplotlib.pyplot module, which provides a MATLAB-like plotting framework.plt.plot(x, y). The marker='o' argument adds circular markers at each data point, and linestyle='-' specifies a solid line connecting the markers.plt.xlabel() and plt.ylabel() respectively.plt.title().plt.grid(True).plt.show().You can run this code in a Python environment that has Matplotlib installed, and it will display a simple line plot with labeled axes and a title. Feel free to customize the data, plot style, labels, and other properties to suit your needs.
Python Mega Course: Learn Python in 60 Days, Build 20 Apps
Learn Python on Udemy completely in 60 days or less by building 20 real-world applications from web development to data science.
