How to build a shortcut to a subtask using the pandas function DataFrame chart function

By default, pandas.DataFrame.plot (), using the subtitle option, does not seem to make it easy to build a shortcut for each subtitle. I am trying to build a pandas framework that has a subtask per column in a data frame. The code still does not work:

fig = plt.figure(figsize=(10,10)) ax = plt.gca() df.plot(y=vars, ax=ax, subplots=True, layout=(3,1), sharex=True, legend=False,) ax.set_ylabel = ['y','x', 'z'] 

But this does not create any shortcuts at all.

+5
source share
1 answer

You can set the y mark on each volume separately.

 import pandas as pd import numpy as np import matplotlib.pyplot as plt # data df = pd.DataFrame(np.random.randn(100,3), columns=list('ABC')) # plot axes = df.plot(figsize=(10, 10), subplots=True, sharex=True, legend=False) axes[0].set_ylabel('yA') axes[1].set_ylabel('yB') axes[2].set_ylabel('yC') 

enter image description here

+6
source

All Articles