0% found this document useful (0 votes)
9 views1 page

6 TH Lab Program

Uploaded by

Rahul N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views1 page

6 TH Lab Program

Uploaded by

Rahul N
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

6 a) Write a Python program to illustrate Linear Plotting using

Matplotlib.
import matplotlib.pyplot as plt
# Sample data
x = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]
# Create a linear plot
plt.plot(x, y, marker='o', color='blue', linestyle='--')
# Add labels and title
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Linear Plot Example')
# Show the plot
plt.grid(True)
plt.show()

6 b) Write a Python program to illustrate liner plotting with line


formatting using Matplotlib.
import matplotlib.pyplot as plt
# Sample data
x = [1, 2, 3, 4, 5]
y = [2, 4, 6, 8, 10]
# Create a linear plot with custom line formatting
plt.plot(x, y, marker='o', color='blue', linestyle='--', linewidth=2,
markersize=8, label='Line Example')
# Add labels and title
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Linear Plot with Line Formatting')
# Show a legend
plt.legend()
# Show the plot
plt.grid(True)
plt.show()

You might also like