Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xlabel and ylabel not visible in panda plot

How is it possible to make xlabel and ylabel visible in the following plot?

import pandas as pd
import matplotlib.pyplot as plt
a = {'Test1': {1: 21867186, 4: 20145576, 10: 18018537},
'Test2': {1: 23256313, 4: 21668216, 10: 19795367}}

d = pd.DataFrame(a).T
#print d

f = plt.figure()
plt.xlabel("xTEST")
plt.ylabel("yTEST")

plt.ticklabel_format(style = 'plain')

plt.title('Title here!', color='black')
d.plot(kind='bar', ax=f.gca())
plt.show()
like image 751
user977828 Avatar asked Dec 29 '25 23:12

user977828


1 Answers

xlabel and ylabel are on my plot when I run your example, just a bit outside the display depending on how it is sized.

Try adding the line:

plt.subplots_adjust(bottom=.25, left=.25)

or simply stretching the display window.

like image 133
Paul Avatar answered Jan 01 '26 13:01

Paul