GridSpec for several subheadings "digit containing traversed axes cleared"

I have 4 different df.hist(columns=, by=) that I would like to insert inside GridSpec (2, 2).

Each of them is as follows:

enter image description here

Here is the code:

 stuff = [df1, df2, df4, df3] col = ['blue', 'orange', 'grey', 'green'] fig = plt.figure(figsize=(10,10)) gs = gridspec.GridSpec(2, 2) for i in range(0, len(stuff)): ax = plt.subplot(gs[i]) stuff[i].hist(column='quanti_var', by=stuff[i].quali_var, alpha=.5, color=col[i], ax=ax) 

I have the following UserWarning:

 C:\Anaconda3\lib\site-packages\pandas\tools\plotting.py:3234: UserWarning: To output multiple subplots, the figure containing the passed axes is being cleared "is being cleared", UserWarning) 

and not the output I'm looking for:

enter image description here

I tried several things, including using SubplotSpec without success. Any idea?

Thank you guys for giving me your neurons!

+5
source share

All Articles