Question

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()
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top