On Monday, December 20, 2010, Jose Guzman <sjm.guz...@googlemail.com> wrote:
>
>
>
>
>
>
>
> Hi everybody
>
> I wanted to collect a combination of plots to insert then in a subplot.
> I choose to create Line2D objects to use the .add_line() method of the
> AxesSubplot class, but unfortunately this does lead to the desired
> results.
>
> Here my dummy version:
>
> from
> matplotlib.lines import Line2D
> from matplotlib.pyplot import figure, show
>
> import numpy as np
>
> def subplot_foo(n):
>     """ returns a the combination of 2 Line2D instances """
>     x = np.arange(0, 200, 0.1)
>     y = np.random.randn(len(x))
>     print len(x)
>     #y2 = y+n
>
>     line1 = Line2D(x, y, color = 'k')
>     #line2 = Line2D(x,y2, 'r')
>
>     #return line1+line2
>     return line1
>
>
> fig = figure() # create Figure object
> for i in range(1,5):
>     ax = fig.add_subplot(2,2,i)
>
>     ax.add_line(subplot_foo(i))
>
> show()
>
> First, the Line2D object does not represent
> the plot I want to create.
> Second, I cannot collect various Line2D objects into a Subplot.
>
> Any good idea around?
>
>
>
>

You might want to look at LineCollection objects.

Ben Root

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to