Reputation: 1915
Is it possible to change the background in a pandas chart?
I would like to change the background from white and the line to orange but I cannot find any documentation to do that.
I am using the pandas as follows:
import pandas.io.data as web
import numpy as np
gs = web.get_data_yahoo('gs')['Close']
gs = gs.pct_change()
gs.plot()
Is it possible to change the background to black or any other color?
Upvotes: 13
Views: 22325
Reputation: 54330
plot()
in pandas
are build on matplotlib
. The right way is just to access the plot axes object and change its bgcolor: change the lastlines to:
P=gs.plot()
P.set_axis_bgcolor('g') #or any HTML colorcode, (R,G,B) tuple, (R,G,B,A) tuple, etcetc.
Upvotes: 14