# General Changes
# 1. Labeling the x-axis and y-axis
# 2. Title of the Graph
# 3. Figure Size
# 4. Annotate on the graph
# 5. Scale of the graph
# 6. Grid on the graph
import matplotlib.pyplot as plt
import numpy as np
plt.figure(figsize=(10,3))
x=np.array([10,30,45,67,90])
y=np.array([12,56,27,36,67])
for i in range(len(x)):
plt.text(x[i],y[i],(x[i],y[i]))
for i in range(len(x)):
plt.text(x[i],y[i],f' ({x[i]},{y[i]})')
plt.plot(x,y,color='r',ls='--',lw=3,marker='*',ms=20,markeredgecolor='g')
plt.title('Height-Weight Graph',fontsize=20,fontweight='bold')
plt.xlim(-10,100)
plt.ylim(0,70)
plt.xlabel('X-axis values')
plt.ylabel('Y-axis values')
plt.grid()
plt.xticks(np.arange(-10,101,10))
plt.savefig("mylineplot.png")
plt.show()
# Take a numpy array named person and give 3 names for the same
# Take another numpy array named height and give their respective heights
# Plot a bar graph indicating the same
No comments:
Post a Comment