Sunday, March 29, 2020

labels and colors of the plot of matplotlib in datascience using python

from scipy.stats import norm
import matplotlib.pyplot as plt
import numpy as np

axes = plt.axes()
axes.set_xlim([-5,5])
axes.set_ylim([0,1.0])
axes.set_xticks([-5,-4,-3,-2,-1,0,1,2,3,4,5])
axes.set_yticks([0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0])
axes.grid()
plt.xlabel('Greebles')
plt.ylabel('Probility')
plt.plot(x, norm.pdf(x),'b-')
plt.plot(x,norm.pdf(x, 1.0, 0.5), 'g:')
plt.legend(['Sneetches','Gacks'],loc=4)

plt.savefig('C:\\Users\\Onyx1\\Pictures\\matplotlib\\matplot_lables.jpg', format='jpg')
plt.show()

output:

change line types and colors of the plot of matplotlib library in datascience using python

from scipy.stats import norm
import matplotlib.pyplot as plt
import numpy as np

axes = plt.axes()
axes.set_xlim([-5,5])
axes.set_ylim([0,1.0])
axes.set_xticks([-5,-4,-3,-2,-1,0,1,2,3,4,5])
axes.set_yticks([0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0])
axes.grid()
plt.plot(x, norm.pdf(x),'b-')
plt.plot(x,norm.pdf(x, 1.0, 0.5), 'g:')

plt.savefig('C:\\Users\\Onyx1\\Pictures\\matplotlib\\matplot_x_y_ticks_bg_grid.jpg', format='jpg')
plt.show()

output:

back ground grid for plots in matplotlib in datascience using python

from scipy.stats import norm
import matplotlib.pyplot as plt
import numpy as np

axes = plt.axes()
axes.set_xlim([-5,5])
axes.set_ylim([0,1.0])
axes.set_xticks([-5,-4,-3,-2,-1,0,1,2,3,4,5])
axes.set_yticks([0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0])
axes.grid()
plt.plot(x, norm.pdf(x))
plt.plot(x,norm.pdf(x, 1.0, 0.5))

plt.savefig('C:\\Users\\Onyx1\\Pictures\\matplotlib\\matplot_x_y_ticks_bg_grid.jpg', format='jpg')
plt.show()

output:

python class topic video