Horizontal and vertical lines between subplots

Hi all,

I have created a figure with 4 subplots (2x2) and I want to separate them with a vertical and horizontal lines (see the green lines on my figure edited by Gimp) but I don't know if it's possible (I haven't find any example of that).

I am using Python 2.5.4 and matplotlib version 0.99.0

Thanks,
Maxime

example.png

Hi Maxime,

I hope my example works for you. Please note: I used plt.axes instead of
plt.subplot, although both generate an Axes instance, the latter doesn't
support overlapping axes.

Kind regards,
Matthias

2by2_subplot_separated_by_lines.py (506 Bytes)

···

On Wednesday 28 April 2010 15:07:21 Maxime Bois wrote:

Hi all,

I have created a figure with 4 subplots (2x2) and I want to separate
them with a vertical and horizontal lines (see the green lines on my
figure edited by Gimp) but I don't know if it's possible (I haven't find
any example of that).

I am using Python 2.5.4 and matplotlib version 0.99.0

Thanks,
Maxime

Hi Matthias,

This is exactly what I wanted to do (excepted for the colors of the
lines which are quite horrible :slight_smile: )

Thanks a lot

Cheers,

Maxime

···

Matplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users

You may do this without creating an extra axes (ax0).
Try something like

ax4.plot([0.5, 0.5], [0, 1], color='lightgreen', lw=5,
         transform=gcf().transFigure, clip_on=False)

Regards,

-JJ

···

On Fri, Apr 30, 2010 at 3:56 AM, Matthias Michler <MatthiasMichler@...361...> wrote:

On Wednesday 28 April 2010 15:07:21 Maxime Bois wrote:

Hi all,

I have created a figure with 4 subplots (2x2) and I want to separate
them with a vertical and horizontal lines (see the green lines on my
figure edited by Gimp) but I don't know if it's possible (I haven't find
any example of that).

I am using Python 2.5.4 and matplotlib version 0.99.0

Thanks,
Maxime

Hi Maxime,

I hope my example works for you. Please note: I used plt.axes instead of
plt.subplot, although both generate an Axes instance, the latter doesn't
support overlapping axes.

Kind regards,
Matthias

------------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Hi Jae-Joon

This method is also great and it's working with plt.subplot:

from pylab import *
subplot(221)
subplot(222)
subplot(223)
subplot(224)
plot([0.5, 0.5], [0, 1], color='lightgreen', lw=5,transform=gcf().transFigure, clip_on=False)
plot([0, 1], [0.5, 0.5], color='lightgreen', lw=5,transform=gcf().transFigure, clip_on=False)

Thank you very much

Regards,
Maxime

···

On 04/30/2010 04:02 PM, Jae-Joon Lee wrote:

You may do this without creating an extra axes (ax0).
Try something like

ax4.plot([0.5, 0.5], [0, 1], color='lightgreen', lw=5,
          transform=gcf().transFigure, clip_on=False)

Regards,

-JJ

On Fri, Apr 30, 2010 at 3:56 AM, Matthias Michler > <MatthiasMichler@...361...> wrote:
   

On Wednesday 28 April 2010 15:07:21 Maxime Bois wrote:
     

Hi all,

I have created a figure with 4 subplots (2x2) and I want to separate
them with a vertical and horizontal lines (see the green lines on my
figure edited by Gimp) but I don't know if it's possible (I haven't find
any example of that).

I am using Python 2.5.4 and matplotlib version 0.99.0

Thanks,
Maxime
       

Hi Maxime,

I hope my example works for you. Please note: I used plt.axes instead of
plt.subplot, although both generate an Axes instance, the latter doesn't
support overlapping axes.

Kind regards,
Matthias

------------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options