I usually get around this by writing my plotting routines as functions
that take Axes objects as input. That way, they don't need to know about
the layout of the figure, and I can use the same code for figures with
one or more axes.

I am working on a project involving a sample of galaxies, and sometimes
I need a plot parameter A for one of the galaxies only, in a figure
together with plots of parameters B and C for the same galaxy. Other
times, I need a figure with plots of parameter A only, but with an Axes
for each galaxy in the sample. This approach allows me to use the same
code for both cases.

/Emil

On 2014-05-12 17:06, Yuxiang Wang wrote:
> Hi Eric,
>
> Thank you for your very clear explanation.
>
> -Shawn
>
> On Mon, May 12, 2014 at 3:23 AM, Eric Firing <efir...@hawaii.edu> wrote:
>> On 2014/05/11 7:56 PM, Yuxiang Wang wrote:
>>> Dear all,
>>>
>>> I am curious that whether this is possible in matplotlib:
>>>
>>> I first create some figures, with subplots.
>>>
>>> import matplotlib.pyplot as plt
>>> fig1, axs1 = plt.subplots(2, 2)
>>> fig2, axs2 = plt.subplots(2, 2)
>>>
>>> And then, could I recombine them, so fig3 is composed of the first row
>>> in fig1 (i.e., axs1[0, 0] and axs1[0, 1]) and second row in fig2
>>> (i.e., axs2[1, 0] and axs2[1, 1])?
>>>
>>> Currently, all I could do is to re-plot them. I am curious about
>>> whether there is a way that I can just move axes around and re-combine
>>> them to make new figures. Thanks!
>> No, there is no facility for doing this.  The Axes class is always
>> initialized with a Figure instance.  The Axes and Figure are quite
>> tightly tied together via transforms.
>>
>> Eric
>>
>>> -Shawn
>>>
>>>
>>
>> ------------------------------------------------------------------------------
>> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
>> Instantly run your Selenium tests across 300+ browser/OS combos.
>> Get unparalleled scalability from the best Selenium testing platform 
>> available
>> Simple to use. Nothing to install. Get started now for free."
>> http://p.sf.net/sfu/SauceLabs
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to