python - Reproducing default plot behaviour of pandas.DataFrame.plot -


as frequent user of pandas, want plot data.

using df.plot() convenient, , layout gives me.

i have problem when show generated graph else, it, want tiny changes.

this digresses me trying recreate exact graph in matplotlib, turns couple of hundred rows of code , still not work quite same way df.plot()

is there way settings default plotting behaviour pandas , ad plot?

example:

df = pd.dataframe([1,2,3,6],index=[15,16,17,18], columns=['values']) df.plot(kind='bar') 

this little piece of code makes pretty graph:

enter image description here

trying recreate matplotlib turns few hours of digging through documentation , still not comming quite right solution.

not mention how many lines of configuration code is.

import matplotlib.pyplot plt import matplotlib.ticker plticker import matplotlib.patches mpatches  fig, ax1 = plt.subplots() ax1.bar(df.index, df['values'], 0.4, align='center')        loc = plticker.multiplelocator(base=1.0) ax1.xaxis.set_major_locator(loc) ax1.xaxis.set_ticklabels(["","15", "16", "17", "18"])  plt.show() 

enter image description here

tldr; how can copy behaviour of df.plot() , extend it, without having recreate manually?


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -