0

Any idea why my script below places the title so far from the graphs/subplots? Is it possible to specify the font size of the title?

df = pandas.read_csv('data.csv', delimiter=',', 
                             index_col=0, 
                             parse_dates=[0], dayfirst=True, 
                             names=['Date','1','2','3','4', '5'])

        df.plot(subplots=True, marker='.',markersize=8, title ="Graph", fontsize = 10, color=['r','b','b','b', 'b'], figsize=(8, 18))


        plt.savefig('capture.png')

Thanks a ton!

Gonzalo
  • 1,084
  • 4
  • 20
  • 40
  • have you had a look [here](http://stackoverflow.com/questions/16419670/increase-distance-between-title-and-plot-in-matplolib)? – lhcgeneva Jul 20 '16 at 14:31

1 Answers1

7

You'll have to use matplotlib to edit the font size, as pandas does not allow passing for font sizes or similar, unfortunately (afaik).

try this:

ax = df.plot()
ax.set_title('Graph', fontsize=20)  # or size, alternatively

Essentially, pandas.DataFrame.plot() returns a matplotlib axis object, on which you then can call any methods associated with it.

For more, check out the matplotlib documentation.

deepbrook
  • 2,523
  • 4
  • 28
  • 49