Informatics Practices
Write a Python program to plot two or more lines and set the line markers.
PyPlot
1 Like
Answer
import matplotlib.pyplot as plt
x1 = [10,20,30]
y1 = [20,40,10]
plt.plot(x1, y1, marker='o', label='line1-circle')
x2 = [10,20,30]
y2 = [40,10,30]
plt.plot(x2, y2, marker='s', label='line2-square')
plt.show()
Output

Answered By
1 Like
Related Questions
Write a Python program to draw a line with a suitable label in the X-axis and Y-axis, and a title.
Write a Python program to plot two or more lines with legends, different widths and colors.
Write a Python program to display a bar chart of the number of students in a class. Use different colors for each bar.
Sample data:
Class: I, II, III, IV, V, VI, VII, VIII, IX, X
Strengths: 40, 43, 45, 47, 49, 38, 50, 37, 43, 39Write a Python program to display a horizontal bar chart of the number of students in a class.
Sample data:
Class: I, II, III, IV, V, VI, VII, VIII, IX, X
Strengths: 40, 43, 45, 47, 49, 38, 50, 37, 43, 39