On Thursday, September 6, 2012, jonasr wrote:
> Hello,
>
> i spotted a bug in the Rectangle function when plotting with multiple
> subplot, here is a source code example:
>
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
>
> from matplotlib.pyplot import *
> from numpy import *
> import sys, os
>
> def main():
> f, axs = subplots(1,2)
>
> x=arange(0,10,0.001)
> y=sin(x)
> axs[0].plot(x,y,"blue")#,alpha=1)
> axs[1].plot(x,y,"blue",alpha=1)
>
> rect = Rectangle((0,0), 1, 1, facecolor="blue",alpha=1)
> axs[0].add_patch(rect)
> axs[1].add_patch(rect)
>
> show()
> return 0
>
> if __name__ == '__main__':
> main()
>
> this script should plot two sin functions and a rectangle in both subplots
> .
> the rectangle doesn't seem to appear until i move the area from the left
> subplot (where the rectangle should appear)
> over to the second subplot.
> here is an example how it looks like:
> http://www.imagebanana.com/view/hzm8bjro/example.png
>
> if i remove the command
> axs[1].add_patch(rect)
> the problem doesn't seem to appear
>
> my current matplotlib version is: '1.1.1rc'
> os is ubuntu 12.04
>
> greetz jonas
>
>
>
>
Not a bug. An artist, such as the rectangle patch, can only reliably work
in one axes object at a time. It can not be in two places at once. Make
two rectangles and attach each to an axes, and it will work.
Cheers!
Ben Root
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users