Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to add a new subplot to a figure created by pandas?

I’m creating a plot from pandas dataframe using pandas.DataFrame.plot(), which creates 3×2 subplots. I want to add a new subplot to the final spot. However, it doesn’t appear. What could be the solution?

ax = DF.plot(x = 'time', 
         y = ['A', 'B', 'C', 'D', 'E'], 
         kind = 'line',
         subplots ='True', 
         layout = (3, 2),
         figsize = (12*2/2.54, 8*3/2.54))
DF.plot(x = 'A', 
        y = 'B', 
        kind = 'line',
        ax = ax[2, 1])

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Unhide the last subplot using set_visible:

DF.plot(x = 'A', 
        y = 'B', 
        kind = 'line',
        ax = ax[2, 1])
ax[2, 1].set_visible(True)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading