#4. Write a Python Program to plot two or more lines with
legends, different width, color, marker and style.
import matplotlib.pyplot as
plt
x1=[3,5,7,9,11]
y1=[2,4,6,8,10]
x2=[11,9,7,5,3]
y2=[3,5,7,11,9]
x3=[7,11,5,7,6]
y3=[3,5,7,11,9]
plt.plot(x1,y1,label="Line1",color="r",linewidth="2",linestyle="dotted",
\
marker="o",markersize=5,markeredgecolor="blue")
plt.plot(x2,y2,label="Line2",color="b",linewidth="2.5",linestyle="dashed",
\
marker="D",markersize=6,markeredgecolor="green")
plt.plot(x3,y3,label="Line3",color="g",linewidth="3.5",linestyle="solid",
\
marker="d",markersize=4,markeredgecolor="red")
plt.legend()
plt.title("Multiline
Chart")
plt.xlabel("X
Axis")
plt.ylabel("Y Axis")
plt.show()
No comments:
Post a Comment