Python Forum
How to create matplotlib subplots from figures - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: How to create matplotlib subplots from figures (/thread-24661.html)



How to create matplotlib subplots from figures - vitaly - Feb-25-2020

I want to create subplots from a number of figures I created in different parts of the code which may include linear regression plots, boxplots, etc. I tried my best but could not find a solution.


RE: How to create matplotlib subplots from figures - GodMaster - Feb-26-2020

Hi @vitaly
To do that, you have to use joypy package to create subplots from various figures.

JoyPy is a one-function Python package based on matplotlib + pandas with a single purpose: drawing joyplots (a.k.a. ridgeline plots).


RE: How to create matplotlib subplots from figures - vitaly - Feb-27-2020

Hi GodMaster. Thanks for your response.
I don't think I need ridgeline plots. What I need is to create a bunch of figures and combine them as subplots of a single graph.
It is like
fig1 = plt.figure(constrained_layout=True)
…..
plt.plot(X, Y)

fig2 = plt.figure(constrained_layout=True)
…..
plt.boxplot(…..
……..
and then combine these figures in one plot.

If you still think it can be done with JoyPy, please give me an example.


RE: How to create matplotlib subplots from figures - scidam - Mar-02-2020

There are lots of examples how to put several plots on a figure. See matplotlib gallery.