You can also do

x,y = zip(*pts)

If you don't feel like importing numpy.

Ben

On Sun, Nov 6, 2011 at 12:49 PM, Tony Yu <tsy...@gmail.com> wrote:

>
>
> On Sun, Nov 6, 2011 at 8:20 AM, Gousios George <gg...@windowslive.com>wrote:
>
>> Hello,
>> Is there a way?Like the title says?
>> I have a 2d list  :
>> > [[ 0  1]
>> >  [ 1  1]
>> >  [ 1  0]
>> >  [ 2  0]
>> >  [ 1  0]
>> >  [ 2  0]
>> >  [ 1  0]
>> >  [ 0  0]
>> >  [ 1  0]
>> >  [ 1 -1]]
>>
>> and  i want to do the "listplot' from mathematica.
>>
>
> I don't know of a plot function to do this, but one extra line of code
> should suffice:
>
> pts = [[0, 1],
>     [1, 1],
>     [1, 0],
>     [2, 0],
>     [1, 0],
>     [2, 0],
>     [1, 0],
>     [0, 0],
>     [1, 0],
>     [1,-1]]
> x, y = np.transpose(pts)
> plt.plot(x, y)
>
>
> Best,
> -Tony
>
>
>
> ------------------------------------------------------------------------------
> RSA(R) Conference 2012
> Save $700 by Nov 18
> Register now
> http://p.sf.net/sfu/rsa-sfdev2dev1
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to