Answer to Question #141463 in Python for Dharmarajan

Question #141463
create multiline chart on common plot where three data range plotted on same chart.The data range(s)to be plotted are:data=[[5,25,45,20],[8,1,29,27],9,29,27,39]]
1
Expert's answer
2020-11-02T11:16:27-0500
# libraries
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd


dpi = 80
fig = plt.figure(dpi = dpi, figsize = (512 / dpi, 384 / dpi) )
# Data
df= pd.DataFrame({'x': range(1,5), 'y1': [5,25,45,20], 'y2': [8,1,29,27], 'y3': [9,29,27,39] })
 
# multiple line plot
plt.plot( 'x', 'y1', data=df, marker='o', markerfacecolor='blue', markersize=12, color='skyblue', linewidth=4)
plt.plot( 'x', 'y2', data=df, marker='o', markerfacecolor='blue', markersize=12, color='skyblue', linewidth=4)
plt.plot( 'x', 'y3', data=df, marker='o', markerfacecolor='blue', markersize=12, color='skyblue', linewidth=4)
plt.legend()
fig.savefig('trigan.png')

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