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

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
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 Fri, 13 Nov 2015 09:34:23 +0100
Lines 20
Message-ID <mailman.284.1447403673.16136.python-list@python.org> (permalink)
References <40964e99-cd31-4daa-8f5f-069b09816b3d@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset="us-ascii"
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de BtF3cRpNgGZe4NUZDZMVQwKJ8LUnuFVufV5aiE4lRTLw==
Return-Path <lac@openend.se>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'error:': 0.05; 'subject:Error': 0.07; 'valueerror:': 0.07; 'cc:addr:python-list': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'subject:same': 0.09; 'python': 0.10; 'subject:error': 0.11; 'thu,': 0.15; 'abhishek': 0.16; 'arrays.': 0.16; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'code?': 0.16; 'dimension': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'message-id:@fido.openend.se': 0.16; 'numpy': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'laura': 0.18; '2015': 0.20; 'cc:addr:python.org': 0.20; 'cc:2**1': 0.22; 'arrays': 0.22; 'rid': 0.22; 'trying': 0.22; '(most': 0.24; 'rest': 0.26; 'error': 0.27; 'guarantees': 0.29; 'matplotlib': 0.29; 'received:se': 0.29; 'cc:no real name:2**1': 0.29; 'too.': 0.30; 'code': 0.30; 'getting': 0.33; 'run': 0.33; 'rate.': 0.33; 'traceback': 0.33; 'file': 0.34; 'list': 0.34; 'gets': 0.35; 'trouble': 0.35; 'nov': 0.35; 'skip:p 30': 0.35; 'but': 0.36; 'subject:: ': 0.37; 'skip:s 50': 0.37; 'charset:us-ascii': 0.37; 'list.': 0.37; 'some': 0.40; 'header:Message-Id:1': 0.61; 'cast': 0.66; 'subject:have': 0.80; '128,': 0.84; 'header:In-reply-to:1': 0.84; 'subject:Value': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=openend.se; s=default; t=1447403666; bh=2NjdpSJ0GF68MtwMJ6IUhvDnaNzo+wFy84nuT1peFEc=; h=To:cc:From:Subject:In-reply-to:References:Date:From; b=Gh7g+dPIxbTIuyCuNqSQyudoIliCsYjmTBu4qk80WZohrSi42/5DsAzY/U+VHN9sk 3EQWj3xrk2fLjcPrVbsIOhGzQthi4oU5R5jYoqgDfuWf2YhqrCm/nyYz1SXUWw7s0m HRjdozP6MpulIiYFeRSrIqknOmo+c68d+QClht0w=
In-reply-to <40964e99-cd31-4daa-8f5f-069b09816b3d@googlegroups.com>
Comments In-reply-to Abhishek <abhishek.mallela@gmail.com> message dated "Thu, 12 Nov 2015 17:54:28 -0800."
Content-ID <5831.1447403663.1@fido>
X-Greylist Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [82.96.5.2]); Fri, 13 Nov 2015 09:34:26 +0100 (CET)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:98731

Show key headers only | 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