Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #98731

Re: Matplotlib error: Value Error: x and y must have same first dimension

From Laura Creighton <lac@openend.se>
Newsgroups comp.lang.python
Subject Re: Matplotlib error: Value Error: x and y must have same first dimension
Date 2015-11-13 09:34 +0100
Message-ID <mailman.284.1447403673.16136.python-list@python.org> (permalink)
References <40964e99-cd31-4daa-8f5f-069b09816b3d@googlegroups.com>

Show all headers | View raw


In a message of Thu, 12 Nov 2015 17:54:28 -0800, Abhishek writes:
>I am trying to run some Python code for the last few hours. How can I achieve the effect of "dot divide" from Matlab, in the following code? I am having trouble working with list comprehension and numpy arrays and getting the following error:
>
>    Traceback (most recent call last):
>      File "Thurs.py", line 128, in <module>
>        plt.plot(np.array(range(1,N/2+2)), Splot[alpha][iii,val]/utot[iii,val],color=cmap(iii/50))
>
>    ValueError: x and y must have same first dimension

Splot is a list.  matplotlib wants 2 numpy arrays.  You have to cast
it with np.array() too.

no guarantees that the rest of the code works -- it is not plotting for
me -- but that gets rid of that error at any rate.

Laura

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Matplotlib error: Value Error: x and y must have same first dimension Abhishek <abhishek.mallela@gmail.com> - 2015-11-12 17:54 -0800
  Re: Matplotlib error: Value Error: x and y must have same first dimension Laura Creighton <lac@openend.se> - 2015-11-13 09:34 +0100
  Re: Matplotlib error: Value Error: x and y must have same first dimension Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2015-11-13 14:04 +0000
  Re: Matplotlib error: Value Error: x and y must have same first dimension Laura Creighton <lac@openend.se> - 2015-11-13 16:43 +0100
  Re: Matplotlib error: Value Error: x and y must have same first dimension Abhishek Mallela <abhishek.mallela@gmail.com> - 2015-11-13 11:44 -0600

csiph-web