Answer to Question #319914 in Python for sung jin woo

Question #319914

1.How do you show a legend for a line chart with multiple lines in python?

2.How you set a title for a chart in python?



1
Expert's answer
2022-03-30T14:10:40-0400
import matplotlib.pyplot as plt

# data sets are x,y and a,b

fig, ax = plt.subplots()
ax.plot(x, y)
ax.plot(a, b)

# to set legend
ax.legend()

# to set title
ax.title()

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS