SourceForge logo
SourceForge logo
Menu

matplotlib-users — Discussion related to using matplotlib

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
(3)
Jun
Jul
Aug
(12)
Sep
(12)
Oct
(56)
Nov
(65)
Dec
(37)
2004 Jan
(59)
Feb
(78)
Mar
(153)
Apr
(205)
May
(184)
Jun
(123)
Jul
(171)
Aug
(156)
Sep
(190)
Oct
(120)
Nov
(154)
Dec
(223)
2005 Jan
(184)
Feb
(267)
Mar
(214)
Apr
(286)
May
(320)
Jun
(299)
Jul
(348)
Aug
(283)
Sep
(355)
Oct
(293)
Nov
(232)
Dec
(203)
2006 Jan
(352)
Feb
(358)
Mar
(403)
Apr
(313)
May
(165)
Jun
(281)
Jul
(316)
Aug
(228)
Sep
(279)
Oct
(243)
Nov
(315)
Dec
(345)
2007 Jan
(260)
Feb
(323)
Mar
(340)
Apr
(319)
May
(290)
Jun
(296)
Jul
(221)
Aug
(292)
Sep
(242)
Oct
(248)
Nov
(242)
Dec
(332)
2008 Jan
(312)
Feb
(359)
Mar
(454)
Apr
(287)
May
(340)
Jun
(450)
Jul
(403)
Aug
(324)
Sep
(349)
Oct
(385)
Nov
(363)
Dec
(437)
2009 Jan
(500)
Feb
(301)
Mar
(409)
Apr
(486)
May
(545)
Jun
(391)
Jul
(518)
Aug
(497)
Sep
(492)
Oct
(429)
Nov
(357)
Dec
(310)
2010 Jan
(371)
Feb
(657)
Mar
(519)
Apr
(432)
May
(312)
Jun
(416)
Jul
(477)
Aug
(386)
Sep
(419)
Oct
(435)
Nov
(320)
Dec
(202)
2011 Jan
(321)
Feb
(413)
Mar
(299)
Apr
(215)
May
(284)
Jun
(203)
Jul
(207)
Aug
(314)
Sep
(321)
Oct
(259)
Nov
(347)
Dec
(209)
2012 Jan
(322)
Feb
(414)
Mar
(377)
Apr
(179)
May
(173)
Jun
(234)
Jul
(295)
Aug
(239)
Sep
(276)
Oct
(355)
Nov
(144)
Dec
(108)
2013 Jan
(170)
Feb
(89)
Mar
(204)
Apr
(133)
May
(142)
Jun
(89)
Jul
(160)
Aug
(180)
Sep
(69)
Oct
(136)
Nov
(83)
Dec
(32)
2014 Jan
(71)
Feb
(90)
Mar
(161)
Apr
(117)
May
(78)
Jun
(94)
Jul
(60)
Aug
(83)
Sep
(102)
Oct
(132)
Nov
(154)
Dec
(96)
2015 Jan
(45)
Feb
(138)
Mar
(176)
Apr
(132)
May
(119)
Jun
(124)
Jul
(77)
Aug
(31)
Sep
(34)
Oct
(22)
Nov
(23)
Dec
(9)
2016 Jan
(26)
Feb
(17)
Mar
(10)
Apr
(8)
May
(4)
Jun
(8)
Jul
(6)
Aug
(5)
Sep
(9)
Oct
(4)
Nov
Dec
2017 Jan
(5)
Feb
(7)
Mar
(1)
Apr
(5)
May
Jun
(3)
Jul
(6)
Aug
(1)
Sep
Oct
(2)
Nov
(1)
Dec
2018 Jan
Feb
Mar
Apr
(1)
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2020 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
2025 Jan
(1)
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S


1
2
3
(4)
4
5
6
7
8
9
(4)
10
(1)
11
12
13
14
15
16
(4)
17
(3)
18
(3)
19
20
21
22
23
24
(1)
25
26
(1)
27
28
(8)
29
(4)
30
(1)



Showing 8 results of 8

From: Eric F. <ef...@ha...> - 2015年09月28日 21:46:01
On 2015年09月28日 5:43 AM, Benjamin Root wrote:
> Confirmed using a fairly recent matplotlib checkout. Could you file a
> bug report? This is going to need some investigating.
Line3D.set_3d_properties is not doing anything to turn zs into an 
ndarray; in fact, when zs is a scalar, it is turning it into a list. I 
suspect this is the place to make it an array. Probably better here 
than anywhere farther down. It also looks to me like Line3D.__init__ 
should be using self.set_3d_properties.
From: Gael V. <gae...@no...> - 2015年09月28日 21:21:43
Dear Pythonistas,
We have just released a new version of the "scipy lecture notes":
http://www.scipy-lectures.org/
These are a consistent set of materials to learn the core aspects of the
scientific Python ecosystem, from beginner to expert. They are written
and maintained by a set of volunteers and published under a CC-BY
license.
Highlights of the latest version includes:
 * a chapter giving a introduction to statistics in Python
 * a new layout with emphasis on readability including on small devices
 * fully doctesting for Python 2 and 3 compatibility
We hope that you will find these notes useful, for you, your colleagues,
or your students.
Gaël
From: Daniele N. <da...@gr...> - 2015年09月28日 20:55:47
On 28/09/15 22:25, Jerzy Karczmarczuk wrote:
> 
> Le 28/09/2015 21:03, Benjamin Root a écrit :
>> Where does he multiply a list by a float? The traceback shows the 
>> multiplication happening much further down in the draw stack.
> 
> Look, Benjamin Root, I don't know, and I will not "investigate" where 
> this operation happens. The diagnosis is a standard Python message. 
> Thus, I took the program of Shakhti Kannan, and in a few seconds I changed
> 
> 
> x = [1.0, 2.0, 3.0] into x = np.array([1.0, 2.0, 3.0])
> 
> and in update_line: x.append(1.0) into x=np.concatenate((x,[1.0]))
> 
> And the program began to run without error messages. So, please, these 
> are FACTS: somewhere the lists x,y,z get down in this draw stack.
No one is doubting that.
>> That shouldn't matter. ax.plot() accepts lists as valid inputs and it 
>> should be converting them into numpy arrays under the hood.
> 
> There are two different issues, accepting any sequences/iterators is 
> one, converting them into arrays - another one. This second operation 
> visibly doesn't take place.
And this is a bug in matplotlib that needs to be fixed. Your solution is
just a workaround to an existing problem in matplotlib.
Cheers,
Daniele
From: Benjamin R. <ben...@gm...> - 2015年09月28日 20:39:04
Jerzy,
On Mon, Sep 28, 2015 at 4:25 PM, Jerzy Karczmarczuk <
jer...@un...> wrote:
>
> Le 28/09/2015 21:03, Benjamin Root a écrit :
>
>> Where does he multiply a list by a float? The traceback shows the
>> multiplication happening much further down in the draw stack.
>>
>
> Look, Benjamin Root, I don't know, and I will not "investigate" where this
> operation happens.
I did not ask you to investigate anything for me. You made the assertion
that the user was multiplying a list by a float, therefore, I assumed that
you were seeing something that I had not seen.
> The diagnosis is a standard Python message. Thus, I took the program of
> Shakhti Kannan, and in a few seconds I changed
>
>
> x = [1.0, 2.0, 3.0] into x = np.array([1.0, 2.0, 3.0])
>
> and in update_line: x.append(1.0) into x=np.concatenate((x,[1.0]))
>
> And the program began to run without error messages. So, please, these are
> FACTS: somewhere the lists x,y,z get down in this draw stack.
>
>
I realize that, and that isn't in dispute. Nowhere did I say that
converting the lists into numpy arrays would not solve the problem.
> That shouldn't matter. ax.plot() accepts lists as valid inputs and it
>> should be converting them into numpy arrays under the hood.
>>
>
> There are two different issues, accepting any sequences/iterators is one,
> converting them into arrays - another one. This second operation visibly
> doesn't take place.
>
>
Of course the second operation isn't visible. I did say that it happens
"under the hood". His program is perfectly valid (albeit not ideal) and
demonstrated a bug in matplotlib's codebase. That is why I asked him to
file a bug report. My reading of your email is that you are upset for some
reason, but I have no clue why.
Ben Root
From: Jerzy K. <jer...@un...> - 2015年09月28日 20:25:16
Le 28/09/2015 21:03, Benjamin Root a écrit :
> Where does he multiply a list by a float? The traceback shows the 
> multiplication happening much further down in the draw stack.
Look, Benjamin Root, I don't know, and I will not "investigate" where 
this operation happens. The diagnosis is a standard Python message. 
Thus, I took the program of Shakhti Kannan, and in a few seconds I changed
x = [1.0, 2.0, 3.0] into x = np.array([1.0, 2.0, 3.0])
and in update_line: x.append(1.0) into x=np.concatenate((x,[1.0]))
And the program began to run without error messages. So, please, these 
are FACTS: somewhere the lists x,y,z get down in this draw stack.
> That shouldn't matter. ax.plot() accepts lists as valid inputs and it 
> should be converting them into numpy arrays under the hood.
There are two different issues, accepting any sequences/iterators is 
one, converting them into arrays - another one. This second operation 
visibly doesn't take place.
J. Karczmarczuk
From: Benjamin R. <ben...@gm...> - 2015年09月28日 19:04:07
On Mon, Sep 28, 2015 at 2:28 PM, Jerzy Karczmarczuk <
jer...@un...> wrote:
> Shakhti Kannan tries to multiply a list by a float, and Python disagrees.
>
>
Where does he multiply a list by a float? The traceback shows the
multiplication happening much further down in the draw stack.
> Le 28/09/2015 17:43, Benjamin Root comments :
> > Could you file a bug report? This is going to need some investigating.
>
> ==
>
> I suspect that it can be solved without Hercule Poirot.
> Convert *at the beginning* your lists x,y,z into np.arrays.
> (also: append ==> concatenate)
>
That shouldn't matter. ax.plot() accepts lists as valid inputs and it
should be converting them into numpy arrays under the hood. Indeed, if one
takes out the animation creation, the code works just fine. Adding new
plots(), while inefficient, shouldn't cause this problem.
Ben Root
From: Jerzy K. <jer...@un...> - 2015年09月28日 18:43:21
Shakhti Kannan tries to multiply a list by a float, and Python disagrees.
Le 28/09/2015 17:43, Benjamin Root comments :
> Could you file a bug report? This is going to need some investigating.
==
I suspect that it can be solved without Hercule Poirot.
Convert *at the beginning* your lists x,y,z into np.arrays.
(also: append ==> concatenate)
Jerzy Karczmarczuk
/Caen, France/.
From: Benjamin R. <ben...@gm...> - 2015年09月28日 15:43:55
Confirmed using a fairly recent matplotlib checkout. Could you file a bug
report? This is going to need some investigating.
As a side note though, the way you are updating the lines by calling
`ax.plot` repeatedly, is bad form. You want to update the lines object
itself, by calling its "set_data()" method. Also, move the call to
`ax.legend()` to after calling `ax.plot` to avoid the warnings about
unlabeled plotting objects.
On Sat, Sep 26, 2015 at 3:46 AM, Shakthi Kannan <sha...@gm...>
wrote:
> Hi,
>
> I am trying to create poly lines using matplotlib and animation. My
> code snippet is as follows:
>
> === BEGIN ===
>
> import matplotlib as mpl
> from mpl_toolkits.mplot3d import Axes3D
> import numpy as np
> import matplotlib.pyplot as plt
> import matplotlib.animation as animation
>
> def update_line(num, x, y, z, l):
> x.append(1.0)
> y.append (2.0)
> z.append(3.0)
> print x, y, z
> l, = ax.plot(x, y, z, label='Line')
> return l,
>
> fig = plt.figure()
> ax = fig.gca(projection='3d')
> ax.set_xlabel('X')
> ax.set_ylabel('Y')
> ax.set_zlabel('Z')
> ax.legend()
>
> x = [1.0, 2.0, 3.0]
> y = [4.0, 7.0, 8.0]
> z = [6.0, 9.0, 5.0]
>
> l, = ax.plot(x, y, z, label='Line')
>
> line_ani = animation.FuncAnimation(fig, update_line, 25, fargs=(x, y,
> z, l), interval=2000, blit=True)
>
> plt.show()
>
> === END ===
>
> The error that I get:
>
> === ERROR ===
>
> $ python mat-3.py
>
> /usr/lib/pymodules/python2.7/matplotlib/axes.py:4747: UserWarning: No
> labeled objects found. Use label='...' kwarg on individual plots.
> warnings.warn("No labeled objects found. "
> [1.0, 2.0, 3.0, 1.0] [4.0, 7.0, 8.0, 2.0] [6.0, 9.0, 5.0, 3.0]
> Exception in Tkinter callback
> Traceback (most recent call last):
> File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1535, in __call__
> return self.func(*args)
> File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 586, in callit
> func(*args)
> File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py",
> line 363, in idle_draw
> self.draw()
> File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py",
> line 348, in draw
> FigureCanvasAgg.draw(self)
> File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py",
> line 451, in draw
> self.figure.draw(self.renderer)
> File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55,
> in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 1034, in
> draw
> func(*args)
> File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/axes3d.py",
> line 270, in draw
> Axes.draw(self, renderer)
> File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55,
> in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 2086, in
> draw
> a.draw(renderer)
> File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/art3d.py",
> line 117, in draw
> xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
> File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/proj3d.py",
> line 194, in proj_transform
> return proj_transform_vec(vec, M)
> File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/proj3d.py",
> line 153, in proj_transform_vec
> vecw = np.dot(M, vec)
> TypeError: can't multiply sequence by non-int of type 'float'
> [1.0, 2.0, 3.0, 1.0, 1.0] [4.0, 7.0, 8.0, 2.0, 2.0] [6.0, 9.0, 5.0, 3.0,
> 3.0]
> Exception in Tkinter callback
> Traceback (most recent call last):
> File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1535, in __call__
> return self.func(*args)
> File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py",
> line 276, in resize
> self.show()
> File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py",
> line 348, in draw
> FigureCanvasAgg.draw(self)
> File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_agg.py",
> line 451, in draw
> self.figure.draw(self.renderer)
> File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55,
> in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File "/usr/lib/pymodules/python2.7/matplotlib/figure.py", line 1034, in
> draw
> func(*args)
> File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/axes3d.py",
> line 270, in draw
> Axes.draw(self, renderer)
> File "/usr/lib/pymodules/python2.7/matplotlib/artist.py", line 55,
> in draw_wrapper
> draw(artist, renderer, *args, **kwargs)
> File "/usr/lib/pymodules/python2.7/matplotlib/axes.py", line 2086, in
> draw
> a.draw(renderer)
> File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/art3d.py",
> line 117, in draw
> xs, ys, zs = proj3d.proj_transform(xs3d, ys3d, zs3d, renderer.M)
> File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/proj3d.py",
> line 194, in proj_transform
> return proj_transform_vec(vec, M)
> File "/usr/lib/pymodules/python2.7/mpl_toolkits/mplot3d/proj3d.py",
> line 153, in proj_transform_vec
> vecw = np.dot(M, vec)
> TypeError: can't multiply sequence by non-int of type 'float'
>
> === END ===
>
> I am using the basic_example.py as a template.
>
> http://matplotlib.org/1.4.1/examples/animation/basic_example.html
>
> What could I be missing? Appreciate any help in this regard,
>
> Thanks!
>
> SK
>
> --
> Shakthi Kannan
> http://www.shakthimaan.com
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

Showing 8 results of 8

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /