Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: module 'matplotlib.pyplot' has no attribute 'xlable'

import matplotlib.pyplot as plt

squares = [1,4,9,16,25]
plt.plot(squares,linewidth=5)

plt.title('Square Number',fontsize=24)
plt.xlable('Value',fontsize=14)
plt.ylable('Square of Value',fontsize=14)

plt.tick_params(axis='both',lablesize=14)
plt.show()

enter image description here

Is it because of the version of the problem?

like image 287
Bruin Avatar asked Jun 06 '17 03:06

Bruin


1 Answers

You can try like this :

import matplotlib.pyplot as plt

squares = [1,4,9,16,25]
plt.plot(squares,linewidth=5)

plt.title('Square Number',fontsize=24)
plt.xlabel('Value',fontsize=14)
plt.ylabel('Square of Value',fontsize=14)

plt.tick_params(axis='both',labelsize=14)
plt.show()

your question is and should be changed to,

xlable -> xlabel,

ylable -> ylabel,

lablesize -> labelsize, spell the label right.

like image 123
youDaily Avatar answered Oct 26 '22 23:10

youDaily