Markus Baden, on 2011-04-06 10:18,  wrote:
> Hi,
> 
> I draw four subplots that touch each other. Thus the "middle cross" of the
> frame is drawn twice and appears to be thicker then the "outer rectangle". I
> came across an old post for an custom Axes that would allow to only draw
> part of the frame
> 
> http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg10242.html
> 
> However, when I run the example provided I get an "can't set attribute
> error" (see traceback below). I use Python 2.7.1 |EPD 7.0-1 (32-bit) on Mac
> OS 10.5.8, which includes matplotlib version 1.0.1.
> 
> Is there a fix to get the custom class running again, or is there an
> alternative way to achieve what I intend?

Hi Markus,

I didn't look at that code but I think the alternative you're
looking for is 

ax.spines['right'].set_visible(False)
ax.spines['bottom'].set_visible(False)

where you use the appropriate locations you want changed for the
different subplots axes.

If you're going to have a lot of subplots, you can simplify the
logic by first setting all spines to being invisible, and then
using ax.is_first_col(), is_first_row() and the corresponding
is_last_* methods to set the appropriate spines back to visible.

Like this:

#show only the outside spines
for ax in all_axes:
    for sp in ax.spines.values():
        sp.set_visible(False)
    if ax.is_first_row():
        ax.spines['top'].set_visible(True)
    if ax.is_last_row():
        ax.spines['bottom'].set_visible(True)
    if ax.is_first_col():
        ax.spines['left'].set_visible(True)
    if ax.is_last_col():
        ax.spines['right'].set_visible(True)

best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to