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
(2)
3
(16)
4
(22)
5
(7)
6
7
(9)
8
(2)
9
10
(7)
11
(15)
12
(7)
13
(4)
14
(7)
15
(3)
16
(6)
17
(20)
18
(18)
19
(15)
20
(27)
21
(14)
22
23
(1)
24
(18)
25
(22)
26
(36)
27
(17)
28
(6)
29
(2)
30
(3)
31
(6)





Showing 22 results of 22

From: <ai...@gm...> - 2010年05月04日 22:41:05
I have strange problem while I am importing matplotlib.
When I try with python console I get:
ailpein@crane:~/programming/python$ python
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import matplotlib
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/usr/lib/pymodules/python2.6/matplotlib/__init__.py", line 129, 
in <module>
 from rcsetup import defaultParams, validate_backend, validate_toolbar
 File "/usr/lib/pymodules/python2.6/matplotlib/rcsetup.py", line 18, in 
<module>
 from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
 File "/usr/lib/pymodules/python2.6/matplotlib/fontconfig_pattern.py", 
line 23, in <module>
 from matplotlib.pyparsing import Literal, ZeroOrMore, \
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line 71, 
in <module>
 import xml.sax.saxutils
 File "/usr/lib/python2.6/xml/sax/saxutils.py", line 6, in <module>
 import os, urlparse, urllib, types
 File "/usr/lib/python2.6/urllib.py", line 26, in <module>
 import socket
 File "socket.py", line 7, in <module>
 except socket.error:
AttributeError: 'module' object has no attribute 'error'
Error in sys.excepthook:
Traceback (most recent call last):
 File "/usr/lib/python2.6/dist-packages/apport_python_hook.py", line 
39, in apport_excepthook
 from apport.packaging_impl import impl as packaging
 File "/usr/lib/python2.6/dist-packages/apport/__init__.py", line 1, in 
<module>
 from apport.report import Report
 File "/usr/lib/python2.6/dist-packages/apport/report.py", line 14, in 
<module>
 import subprocess, tempfile, os.path, urllib, re, pwd, grp, os, sys
 File "/usr/lib/python2.6/urllib.py", line 26, in <module>
 import socket
 File "socket.py", line 7, in <module>
 except socket.error:
AttributeError: 'module' object has no attribute 'error'
Original exception was:
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/usr/lib/pymodules/python2.6/matplotlib/__init__.py", line 129, 
in <module>
 from rcsetup import defaultParams, validate_backend, validate_toolbar
 File "/usr/lib/pymodules/python2.6/matplotlib/rcsetup.py", line 18, in 
<module>
 from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
 File "/usr/lib/pymodules/python2.6/matplotlib/fontconfig_pattern.py", 
line 23, in <module>
 from matplotlib.pyparsing import Literal, ZeroOrMore, \
 File "/usr/lib/pymodules/python2.6/matplotlib/pyparsing.py", line 71, 
in <module>
 import xml.sax.saxutils
 File "/usr/lib/python2.6/xml/sax/saxutils.py", line 6, in <module>
 import os, urlparse, urllib, types
 File "/usr/lib/python2.6/urllib.py", line 26, in <module>
 import socket
 File "socket.py", line 7, in <module>
 except socket.error:
AttributeError: 'module' object has no attribute 'error'
But when i try with ipython, then everything is OK.
ailpein@crane:~/programming/python$ ipython
Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15)
Type "copyright", "credits" or "license" for more information.
IPython 0.10 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [1]: import matplotlib
In [2]:
Could anyone explain me how to fix that?
Thank You in advance.
B. Krajnik
From: Jeff W. <js...@fa...> - 2010年05月04日 22:36:21
On 5/4/10 4:25 PM, Timothy W. Hilton wrote:
> Hi Jeff,
>
> Thanks very much for your response. As you noted, I do not understand
> the Basemap global sinusoidal coordinate system. Does this statement
> not set up a global sinusoidal cartesian coordinate system centered at
> (lon = 0.0, lat = 0.0)?
> 
Tim: It's a global sinusoidal projection, but x=0,y=0 is not at 
lon_0,lat_0.
 >> from mpl_toolkits.basemap import Basemap
 >> m = Basemap(projection='sinu', resolution=None, lon_0=0.0, lat_0=0.0)
 >> print m(0,0,inverse=True)
(-176.20919036912957, -89.999999999808395)
I forget why I did it this way, but I think it has to do with the fact 
that the matplotlib coordinate system has 0,0 in the lower left corner, 
not the middle.
At any rate, apply a offset to x and y to map to your global coordinate 
system.
-Jeff
> m = Basemap(projection='sinu', resolution=None, lon_0=0.0, lat_0=0.0)
>
> If so, I would expect m(0.0, 0.0) to return (0.0, 0.0) and m(0.0, 0.0,
> inverse=True) to return (0.0, 0.0). Instead, I get:
> 
>>>> m(0.0,0.0)
>>>> 
> (20015077.371199999, 10007538.6856)
> 
>>>> m(0.0,0.0,inverse=True)
>>>> 
> (-176.20919036912957, -89.999999999808395)
>
> Sorry if I am being obtuse. Many thanks for your help.
>
> -Tim
>
> On Tue, May 2010, 04 at 04:01:21PM -0600, Jeff Whitaker wrote:
> 
>> On 5/4/10 2:03 PM, Timothy W. Hilton wrote:
>> 
>>> Hello matplotlib users,
>>>
>>> I am having trouble understanding the coordinate transformations in
>>> Basemap and pyproj. I have gridded MODIS vegetation data, with upper
>>> left corner and lower right corner given in projection coordinates
>>> (meters). I want to contour the data with Basemap. The data are in a
>>> sinusoidal projection, but the coordinates do not correspond to what
>>> Basemap seems to expect.
>>>
>>> The code below illustrates the problem. Proj translates the upper
>>> left to lat/lon correctly (-92.327237416031437, 30.141972433747089),
>>> while Basemap does not.
>>>
>>> #-------- code --------
>>> 
>> >from mpl_toolkits.basemap import Basemap
>> >from mpl_toolkits.basemap import pyproj
>> 
>>> ulm = [-8895604.1573329996, 3335851.5589999999] #upper left, meters
>>> lrm = [-7783653.6376670003, 2223901.0393329998] #lower right, meters
>>>
>>> sinu = pyproj.Proj(proj='sinu', lon_0=0.0, x_0=0.0, y_0=0.0)
>>> m = Basemap(projection='sinu', resolution=None, lon_0=0.0)
>>>
>>> print "ULM: " + str(ulm)
>>> print "Proj: " + str(sinu(ulm[0], ulm[1], inverse=True))
>>> print "Basemap: " + str(m(ulm[0], ulm[1], inverse=True))
>>> #----- end code --------
>>>
>>> This gives:
>>> ULM: [-8895604.1573329996, 3335851.5589999999]
>>> Proj: (-92.327237416031437, 30.141972433747089)
>>> Basemap: (-159.99950210056144, -59.99995206181125)
>>>
>>> I'm sure I'm missing something really simple, but I've read a lot of
>>> documentation and I'm not sure what.
>>>
>>> Many thanks for any help.
>>>
>>> Best,
>>> Tim
>>> 
>> Tim: Basemap is using pyproj under the hood, but only supports a
>> subset of possible proj4 projections. The basemap sinusoidal
>> projection is global - you can't specify a subregion of the globe.
>> I think that's where the discrepancy is coming from. I'm sure
>> there's a way to plot your MODIS data on a global sinusoidal
>> projection - but it will involve transforming the coordinates to the
>> Basemap global sinuosidal coordinate system.
>>
>> -Jeff
>>
>> 
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Nico S. <nic...@gm...> - 2010年05月04日 22:27:39
This is weird:
When plotting something very simple, e.g.,
 t = arange( 0.0, 2.0, 0.01 )
 s = sin( 2*pi*t )
 plot( t, s, ":" )
I thought I can check weather the grid is on or off by
 gca().get_xgridlines()
-- but this *always* returns
<a list of 5 Line2D xgridline objects>
with *always* the same lines
Line2D((0,0),(0,1))
Line2D((0,0),(0,1))
Line2D((0,0),(0,1))
Line2D((0,0),(0,1))
Line2D((0,0),(0,1))
That's really independent of whether the grid is on or off.
Is there any explanation for it that does not have to do with Harry
Potter or the Jedi? ;)
--Nico
From: Timothy W. H. <hi...@me...> - 2010年05月04日 22:26:33
Hi Jeff,
Thanks very much for your response. As you noted, I do not understand
the Basemap global sinusoidal coordinate system. Does this statement
not set up a global sinusoidal cartesian coordinate system centered at
(lon = 0.0, lat = 0.0)?
m = Basemap(projection='sinu', resolution=None, lon_0=0.0, lat_0=0.0)
If so, I would expect m(0.0, 0.0) to return (0.0, 0.0) and m(0.0, 0.0,
inverse=True) to return (0.0, 0.0). Instead, I get:
>>> m(0.0,0.0)
(20015077.371199999, 10007538.6856)
>>> m(0.0,0.0,inverse=True)
(-176.20919036912957, -89.999999999808395)
Sorry if I am being obtuse. Many thanks for your help.
-Tim
On Tue, May 2010, 04 at 04:01:21PM -0600, Jeff Whitaker wrote:
> On 5/4/10 2:03 PM, Timothy W. Hilton wrote:
> >Hello matplotlib users,
> >
> >I am having trouble understanding the coordinate transformations in
> >Basemap and pyproj. I have gridded MODIS vegetation data, with upper
> >left corner and lower right corner given in projection coordinates
> >(meters). I want to contour the data with Basemap. The data are in a
> >sinusoidal projection, but the coordinates do not correspond to what
> >Basemap seems to expect.
> >
> >The code below illustrates the problem. Proj translates the upper
> >left to lat/lon correctly (-92.327237416031437, 30.141972433747089),
> >while Basemap does not.
> >
> >#-------- code --------
> >from mpl_toolkits.basemap import Basemap
> >from mpl_toolkits.basemap import pyproj
> >
> >ulm = [-8895604.1573329996, 3335851.5589999999] #upper left, meters
> >lrm = [-7783653.6376670003, 2223901.0393329998] #lower right, meters
> >
> >sinu = pyproj.Proj(proj='sinu', lon_0=0.0, x_0=0.0, y_0=0.0)
> >m = Basemap(projection='sinu', resolution=None, lon_0=0.0)
> >
> >print "ULM: " + str(ulm)
> >print "Proj: " + str(sinu(ulm[0], ulm[1], inverse=True))
> >print "Basemap: " + str(m(ulm[0], ulm[1], inverse=True))
> >#----- end code --------
> >
> >This gives:
> >ULM: [-8895604.1573329996, 3335851.5589999999]
> >Proj: (-92.327237416031437, 30.141972433747089)
> >Basemap: (-159.99950210056144, -59.99995206181125)
> >
> >I'm sure I'm missing something really simple, but I've read a lot of
> >documentation and I'm not sure what.
> >
> >Many thanks for any help.
> >
> >Best,
> >Tim
> 
> Tim: Basemap is using pyproj under the hood, but only supports a
> subset of possible proj4 projections. The basemap sinusoidal
> projection is global - you can't specify a subregion of the globe.
> I think that's where the discrepancy is coming from. I'm sure
> there's a way to plot your MODIS data on a global sinusoidal
> projection - but it will involve transforming the coordinates to the
> Basemap global sinuosidal coordinate system.
> 
> -Jeff
> 
From: Jeff W. <js...@fa...> - 2010年05月04日 22:01:29
On 5/4/10 2:03 PM, Timothy W. Hilton wrote:
> Hello matplotlib users,
>
> I am having trouble understanding the coordinate transformations in
> Basemap and pyproj. I have gridded MODIS vegetation data, with upper
> left corner and lower right corner given in projection coordinates
> (meters). I want to contour the data with Basemap. The data are in a
> sinusoidal projection, but the coordinates do not correspond to what
> Basemap seems to expect.
>
> The code below illustrates the problem. Proj translates the upper
> left to lat/lon correctly (-92.327237416031437, 30.141972433747089),
> while Basemap does not.
>
> #-------- code --------
> from mpl_toolkits.basemap import Basemap
> from mpl_toolkits.basemap import pyproj
>
> ulm = [-8895604.1573329996, 3335851.5589999999] #upper left, meters
> lrm = [-7783653.6376670003, 2223901.0393329998] #lower right, meters
>
> sinu = pyproj.Proj(proj='sinu', lon_0=0.0, x_0=0.0, y_0=0.0)
> m = Basemap(projection='sinu', resolution=None, lon_0=0.0)
>
> print "ULM: " + str(ulm)
> print "Proj: " + str(sinu(ulm[0], ulm[1], inverse=True))
> print "Basemap: " + str(m(ulm[0], ulm[1], inverse=True))
> #----- end code --------
>
> This gives:
> ULM: [-8895604.1573329996, 3335851.5589999999]
> Proj: (-92.327237416031437, 30.141972433747089)
> Basemap: (-159.99950210056144, -59.99995206181125)
>
> I'm sure I'm missing something really simple, but I've read a lot of
> documentation and I'm not sure what.
>
> Many thanks for any help.
>
> Best,
> Tim
> 
Tim: Basemap is using pyproj under the hood, but only supports a subset 
of possible proj4 projections. The basemap sinusoidal projection is 
global - you can't specify a subregion of the globe. I think that's 
where the discrepancy is coming from. I'm sure there's a way to plot 
your MODIS data on a global sinusoidal projection - but it will involve 
transforming the coordinates to the Basemap global sinuosidal coordinate 
system.
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Timothy W. H. <hi...@me...> - 2010年05月04日 21:08:03
Hello matplotlib users,
I am having trouble understanding the coordinate transformations in
Basemap and pyproj. I have gridded MODIS vegetation data, with upper
left corner and lower right corner given in projection coordinates
(meters). I want to contour the data with Basemap. The data are in a
sinusoidal projection, but the coordinates do not correspond to what
Basemap seems to expect.
The code below illustrates the problem. Proj translates the upper
left to lat/lon correctly (-92.327237416031437, 30.141972433747089),
while Basemap does not.
#-------- code --------
from mpl_toolkits.basemap import Basemap
from mpl_toolkits.basemap import pyproj
ulm = [-8895604.1573329996, 3335851.5589999999] #upper left, meters
lrm = [-7783653.6376670003, 2223901.0393329998] #lower right, meters
sinu = pyproj.Proj(proj='sinu', lon_0=0.0, x_0=0.0, y_0=0.0)
m = Basemap(projection='sinu', resolution=None, lon_0=0.0)
print "ULM: " + str(ulm)
print "Proj: " + str(sinu(ulm[0], ulm[1], inverse=True))
print "Basemap: " + str(m(ulm[0], ulm[1], inverse=True))
#----- end code --------
This gives:
ULM: [-8895604.1573329996, 3335851.5589999999]
Proj: (-92.327237416031437, 30.141972433747089)
Basemap: (-159.99950210056144, -59.99995206181125)
I'm sure I'm missing something really simple, but I've read a lot of
documentation and I'm not sure what.
Many thanks for any help.
Best,
Tim
--
Timothy W. Hilton
PhD Candidate, Department of Meteorology
The Pennsylvania State University
503 Walker Building, University Park, PA 16802
hi...@me...
From: Pau <vim...@go...> - 2010年05月04日 20:06:00
Hello,
I am trying to generate a 3d-plot
I have two functions that depend on two free parameters,
T_g = (5./512.) * Light_c**5 * a**4 / (Grav_G**3 * m**3)
T_d = 3.e4 * sqrt(a**3/ (Grav_G * m**2.))
These are given in units of time, so that I would like axis y to be
"time", running between 1.0 and 1.e7
The free parameters are "a" and "m". I would like to have the axis
x = a (semi-major axis) , distributed as a = np.arange(1.e10, 1.e15, 5.e11)
z = m (mass) , between 1.e3 and 1.e7
Light_c and Grav_G are two constants
I am trying to follow the examples in
http://matplotlib.sourceforge.net/mpl_toolkits/mplot3d/tutorial.html
but I cannot understand the syntax
Any help would be appreciated
thanks,
Pau
From: Timothy W. H. <hi...@me...> - 2010年05月04日 20:03:13
Hello matplotlib users,
I am having trouble understanding the coordinate transformations in
Basemap and pyproj. I have gridded MODIS vegetation data, with upper
left corner and lower right corner given in projection coordinates
(meters). I want to contour the data with Basemap. The data are in a
sinusoidal projection, but the coordinates do not correspond to what
Basemap seems to expect.
The code below illustrates the problem. Proj translates the upper
left to lat/lon correctly (-92.327237416031437, 30.141972433747089),
while Basemap does not.
#-------- code --------
from mpl_toolkits.basemap import Basemap
from mpl_toolkits.basemap import pyproj
ulm = [-8895604.1573329996, 3335851.5589999999] #upper left, meters
lrm = [-7783653.6376670003, 2223901.0393329998] #lower right, meters
sinu = pyproj.Proj(proj='sinu', lon_0=0.0, x_0=0.0, y_0=0.0)
m = Basemap(projection='sinu', resolution=None, lon_0=0.0)
print "ULM: " + str(ulm)
print "Proj: " + str(sinu(ulm[0], ulm[1], inverse=True))
print "Basemap: " + str(m(ulm[0], ulm[1], inverse=True))
#----- end code --------
This gives:
ULM: [-8895604.1573329996, 3335851.5589999999]
Proj: (-92.327237416031437, 30.141972433747089)
Basemap: (-159.99950210056144, -59.99995206181125)
I'm sure I'm missing something really simple, but I've read a lot of
documentation and I'm not sure what.
Many thanks for any help.
Best,
Tim
--
Timothy W. Hilton
PhD Candidate, Department of Meteorology
The Pennsylvania State University
503 Walker Building, University Park, PA 16802
hi...@me...
From: Jae-Joon L. <lee...@gm...> - 2010年05月04日 19:48:08
Fixed in r8295.
Axes.annotate was not setting the _remove_method attribute.
Regards,
-JJ
On Tue, May 4, 2010 at 3:15 PM, Ryan May <rm...@gm...> wrote:
> On Tue, May 4, 2010 at 2:09 PM, KrishnaPribadi
> <Kri...@ha...> wrote:
>> I'm trying to remove or delete an annotate arrow but I'm unsuccessful. Can
>> some please help? Thanks.
>>
>> I tried the [artist].remove() but that will not work with arrows or annotate
>> objects...
>>
>> Here is some example code, please add in the code I need if you can:
>>
>> import numpy as np
>> import matplotlib.pyplot as plt
>>
>> t = np.arange(0, np.pi*2, 0.01)
>> x = np.sin(2*np.pi*t)
>> fig = plt.figure()
>> myplot = ax.plot(t, x, 'b')
>>
>> arrow = ax. annotate('my arrow', xy=(3, -0.5), xycoords='data',
>>              horizontalalignment='center',
>>              verticalalignment='center',
>>              color='red', alpha=0.5,
>>              xytext=(0, -2), textcoords='offset points',
>>              arrowprops=dict(facecolor='red', frac=0.4,
>> shrink = 0.05, alpha=0.5, width=2, headwidth=5),
>>              )
>>
>> #Code to remove arrow...
>> # arrow.remove() #this does not work...
>>
>> plt.show()
>
> You can accomplish it by:
>
> ax.texts.remove(arrow)
>
> I'd still like to know why this exception gets raised:
>
>
> NotImplementedError            Traceback (most recent call last)
>
> /home/rmay/<ipython console> in <module>()
>
> /home/rmay/.local/lib/python2.6/site-packages/matplotlib/artist.pyc in
> remove(self)
>  123       self._remove_method(self)
>  124     else:
> --> 125       raise NotImplementedError('cannot remove artist')
>  126     # TODO: the fix for the collections relim problem is to move the
>
>  127     # limits calculation into the artist itself, including
> the property
>
>
> NotImplementedError: cannot remove artist
>
> JJ, thoughts?
>
> Ryan
>
> --
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Ryan M. <rm...@gm...> - 2010年05月04日 19:16:11
On Tue, May 4, 2010 at 2:09 PM, KrishnaPribadi
<Kri...@ha...> wrote:
> I'm trying to remove or delete an annotate arrow but I'm unsuccessful. Can
> some please help? Thanks.
>
> I tried the [artist].remove() but that will not work with arrows or annotate
> objects...
>
> Here is some example code, please add in the code I need if you can:
>
> import numpy as np
> import matplotlib.pyplot as plt
>
> t = np.arange(0, np.pi*2, 0.01)
> x = np.sin(2*np.pi*t)
> fig = plt.figure()
> myplot = ax.plot(t, x, 'b')
>
> arrow = ax. annotate('my arrow', xy=(3, -0.5), xycoords='data',
>              horizontalalignment='center',
>              verticalalignment='center',
>              color='red', alpha=0.5,
>              xytext=(0, -2), textcoords='offset points',
>              arrowprops=dict(facecolor='red', frac=0.4,
> shrink = 0.05, alpha=0.5, width=2, headwidth=5),
>              )
>
> #Code to remove arrow...
> # arrow.remove() #this does not work...
>
> plt.show()
You can accomplish it by:
ax.texts.remove(arrow)
I'd still like to know why this exception gets raised:
NotImplementedError Traceback (most recent call last)
/home/rmay/<ipython console> in <module>()
/home/rmay/.local/lib/python2.6/site-packages/matplotlib/artist.pyc in
remove(self)
 123 self._remove_method(self)
 124 else:
--> 125 raise NotImplementedError('cannot remove artist')
 126 # TODO: the fix for the collections relim problem is to move the
 127 # limits calculation into the artist itself, including
the property
NotImplementedError: cannot remove artist
JJ, thoughts?
Ryan
-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
From: KrishnaPribadi <Kri...@ha...> - 2010年05月04日 19:09:37
Hi,
I'm trying to remove or delete an annotate arrow but I'm unsuccessful. Can
some please help? Thanks.
I tried the [artist].remove() but that will not work with arrows or annotate
objects...
Here is some example code, please add in the code I need if you can:
import numpy as np
import matplotlib.pyplot as plt
t = np.arange(0, np.pi*2, 0.01)
x = np.sin(2*np.pi*t)
fig = plt.figure()
myplot = ax.plot(t, x, 'b')
arrow = ax. annotate('my arrow', xy=(3, -0.5), xycoords='data',
 horizontalalignment='center',
 verticalalignment='center',
 color='red', alpha=0.5,
 xytext=(0, -2), textcoords='offset points',
 arrowprops=dict(facecolor='red', frac=0.4,
shrink = 0.05, alpha=0.5, width=2, headwidth=5),
 )
#Code to remove arrow...
# arrow.remove() #this does not work...
plt.show()
-----
Krishna Adrianto Pribadi
Test Engineer
Harley-Davidson Motor Co.
Talladega Test Facility
Vehicle Test Stands
-- 
View this message in context: http://old.nabble.com/remove---delete-arrow---annotate%2C-how-to--tp28451836p28451836.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
From: Eric F. <ef...@ha...> - 2010年05月04日 18:10:05
On 05/03/2010 11:45 PM, Kun Hong wrote:
> Eric,
>
> Thanks a lot for the pointers. Sorry for the double posting.
>
> I tried fill_between, which works better than bar graph.
> But I need to change the data set to be able to get the filling
> into a nicely-formed rectangle, and the performance is still not very good.
>
> As the below example shows:
>
> import matplotlib.mlab as mlab
> from matplotlib.pyplot import figure, show
> import numpy as np
>
> x1 = np.arange(0.0, 10000.0, 0.1)
> y1 = np.sin(2*np.pi*x1)
>
> fig = figure()
> ax1 = fig.add_subplot(111)
>
> x = []
> for i in x1:
> x += [i-0.05, i-0.05, i, i+0.05, i+0.05]
>
> y = []
> for i in y1:
> y += [0, i, i, i, 0]
>
> ax1.fill_between(x, 0, y)
>
>
>
> I have also tried step, but it doesn't seem to be able
> to fill the rectangular area. Am I missing something?
>
Given that you want filled regions, step won't help. It might make 
sense to make the step logic available to fill_between, but this has not 
been done yet.
I don't understand what you really want, though; your code above is 
trying to plot 100,000 bars. Your screen probably has fewer than 2000 
pixels width. You can print with higher resolution than that, but if 
you are making plots for printing, usually the performance is not such 
an issue--and even then, I don't think that packing 100,000 bars onto a 
sheet of paper is going to be very useful.
Eric
> Kun
>
From: Darren D. <dsd...@gm...> - 2010年05月04日 17:57:39
On Tue, May 4, 2010 at 10:58 AM, Gökhan Sever <gok...@gm...> wrote:
>
>
> On Mon, May 3, 2010 at 4:02 PM, Darren Dale <dsd...@gm...> wrote:
>>
>> I got a suggestion at the PyQt4 mailing list, and the following patch
>> appears to resolve the problem.
>>
>> Darren
>>
>
> Thanks Darren.
>
> Your patch fixes the wrong sized figure creation problem. Both for WXAgg and
> Qt4Agg the maximum figure size is limited with the physical screen
> dimensions, right? Just out of curiosity I am asking this. I don't see any
> scroll-bars appearing if one figure dimension is bigger than screen's.
The change was committed in svn 8294. No, the figure windows are not
designed to include scrollbars if the canvas is bigger than the window
will allow. I don't think such a feature would be compatible with the
current ability to resize a canvas by resizing the figure window.
Darren
From: Michael D. <md...@st...> - 2010年05月04日 16:34:01
Pim Schellart wrote:
> Hi Everyone,
>
> I am currently building an interactive display using matplotlib but I
> need the following two options.
> 1. Setting the r axis of a polar plot to logaritmic scale.
> 
axis.set_rscale('log')
> 2. Setting alpha for each point individually (preferably by giving
> alpha an array of the same length as the data containing a value
> between zero and one).
> Is this currently possible and if not which alternative approach do
> you recommend.
> 
You can't give alpha an array, but you can create an Nx4 RGBA array 
(which will let you control the color individually, too). For example:
r = np.arange(0, 3.0, 0.01)
theta = 2*np.pi*r
c = np.zeros((len(r), 4))
c[:,0:3] = (1, 0, 0) # red
c[:,3] = np.arange(0, 1.0, 1.0 / len(r))
ax.scatter(theta, r, c=c, lw=0)
> The display needs to plot about a thousand points (using scatter at
> the moment) roughly updating every second with older points fading
> away (lower value of alpha).
> 
Scatter is pretty heavily optimized in the *Agg backends, but not so 
much in the others. Make sure you are using Agg and IIRC this level of 
performance should be possible (depending on machine etc., of course).
Mike
-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA
From: Pim S. <p.s...@gm...> - 2010年05月04日 16:19:11
Hi Everyone,
I am currently building an interactive display using matplotlib but I
need the following two options.
1. Setting the r axis of a polar plot to logaritmic scale.
2. Setting alpha for each point individually (preferably by giving
alpha an array of the same length as the data containing a value
between zero and one).
Is this currently possible and if not which alternative approach do
you recommend.
The display needs to plot about a thousand points (using scatter at
the moment) roughly updating every second with older points fading
away (lower value of alpha).
Kind regards,
Pim Schellart
From: Gökhan S. <gok...@gm...> - 2010年05月04日 14:58:23
On Mon, May 3, 2010 at 4:02 PM, Darren Dale <dsd...@gm...> wrote:
>
> I got a suggestion at the PyQt4 mailing list, and the following patch
> appears to resolve the problem.
>
> Darren
>
>
Thanks Darren.
Your patch fixes the wrong sized figure creation problem. Both for WXAgg and
Qt4Agg the maximum figure size is limited with the physical screen
dimensions, right? Just out of curiosity I am asking this. I don't see any
scroll-bars appearing if one figure dimension is bigger than screen's.
-- 
Gökhan
From: Kun H. <kun...@gm...> - 2010年05月04日 09:45:33
Eric,
Thanks a lot for the pointers. Sorry for the double posting.
I tried fill_between, which works better than bar graph.
But I need to change the data set to be able to get the filling
into a nicely-formed rectangle, and the performance is still not very good.
As the below example shows:
import matplotlib.mlab as mlab
from matplotlib.pyplot import figure, show
import numpy as np
x1 = np.arange(0.0, 10000.0, 0.1)
y1 = np.sin(2*np.pi*x1)
fig = figure()
ax1 = fig.add_subplot(111)
x = []
for i in x1:
 x += [i-0.05, i-0.05, i, i+0.05, i+0.05]
y = []
for i in y1:
 y += [0, i, i, i, 0]
ax1.fill_between(x, 0, y)
I have also tried step, but it doesn't seem to be able
to fill the rectangular area. Am I missing something?
Kun
Eric Firing wrote:
> On 05/02/2010 05:48 PM, Kun Hong wrote:
> 
>> Hi,
>>
>> I am new to matplotlib. So if I ask sth stupid, please bear with me.
>>
>> I am using matplotlib to present large data set in different graph
>> types,
>> bar, dot, line, etc. I find that the bar graph has very bad performance.
>> Say, I draw data points of about ten thousand. Using dot graph, it draws
>> in a second. But using bar graph, it draws in tens of seconds.
>>
>> I was wondering what causes this difference. Is there a way to improve
>> the
>> bar graph performace? (Maybe I am not drawing it right, then, please
>> give
>> me a pointer)
>>
>> 
>
> Also check out step().
> http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.step
>
> Eric
>
> 
From: Stefanie L. <lu...@ip...> - 2010年05月04日 08:52:14
Hello!
 
Is it possible with the matplotlib basemap tool to draw locations of
interest on my own map e.g. a Garmin Image Map File File?
 
Thanks in advance!
Stefanie
From: Johan G. <joh...@gm...> - 2010年05月04日 05:20:14
2010年05月04日 04:13, Joe Kington skrev:
> Isn't that what quiver
> <http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.quiver>
> does? Or am I misunderstanding the question?
Regardless of the OPs question, the quiver seems to be the solution I 
should use for my purpose.
Thanks.
/ Johan
From: aditya b. <blu...@gm...> - 2010年05月04日 03:12:05
I don't think that plots a vector. Here's the sort of thing I was looking
for:
http://www.mathworks.com/matlabcentral/fx_files/23608/1/content/html/drawLAInro_02.png
Of course it doesn't need to be a point...it can be a line or a line segment
too.
Adit
On Mon, May 3, 2010 at 9:13 PM, Joe Kington <jki...@wi...> wrote:
> Isn't that what quiver<http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.quiver>does? Or am I misunderstanding the question?
>
> 2010年5月3日 aditya bhargava <blu...@gm...>
>
>> Thanks Johan and Matthias,
>> I was just wondering if there was a built-in way to do this in matplotlib.
>> It seems like it would be a useful method to have.
>>
>> Adit
>>
>>
>> 2010年5月3日 Johan Grönqvist <joh...@gm...>
>>
>> 2010年05月02日 20:19, aditya bhargava skrev:
>>> > Is there a straightforward way of plotting a vector in matplotlib?
>>> > Suppose I want to plot the vector [1 2]'. If I pass this vector in to
>>> > plot(), I get the line that passes through (0,1), (1,2). Instead I want
>>> > the line that passes through (0,0),(1,2).
>>> >
>>>
>>> I use pyplot.Arrow to visualize displacement fields.
>>>
>>> This is a snippet copied from the code I use (it sits in a loop over all
>>> vectors I want to plot):
>>>
>>>
>>> arr = plt.Arrow(x, y, dx, dy)
>>> plt.gca().add_patch(arr)
>>>
>>> In your case, you would have (x, y) = (0, 0) and (dx, dy) = (1, 2).
>>>
>>> Regards
>>>
>>> Johan
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Mat...@li...
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>
>>
>>
>>
>> --
>> wefoundland.com
>>
>>
>> ------------------------------------------------------------------------------
>>
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>>
>
-- 
wefoundland.com
From: Joe K. <jki...@wi...> - 2010年05月04日 02:14:09
Isn't that what
quiver<http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.quiver>does?
Or am I misunderstanding the question?
2010年5月3日 aditya bhargava <blu...@gm...>
> Thanks Johan and Matthias,
> I was just wondering if there was a built-in way to do this in matplotlib.
> It seems like it would be a useful method to have.
>
> Adit
>
>
> 2010年5月3日 Johan Grönqvist <joh...@gm...>
>
> 2010年05月02日 20:19, aditya bhargava skrev:
>> > Is there a straightforward way of plotting a vector in matplotlib?
>> > Suppose I want to plot the vector [1 2]'. If I pass this vector in to
>> > plot(), I get the line that passes through (0,1), (1,2). Instead I want
>> > the line that passes through (0,0),(1,2).
>> >
>>
>> I use pyplot.Arrow to visualize displacement fields.
>>
>> This is a snippet copied from the code I use (it sits in a loop over all
>> vectors I want to plot):
>>
>>
>> arr = plt.Arrow(x, y, dx, dy)
>> plt.gca().add_patch(arr)
>>
>> In your case, you would have (x, y) = (0, 0) and (dx, dy) = (1, 2).
>>
>> Regards
>>
>> Johan
>>
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>
>
>
> --
> wefoundland.com
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
From: aditya b. <blu...@gm...> - 2010年05月04日 01:03:11
Thanks Johan and Matthias,
I was just wondering if there was a built-in way to do this in matplotlib.
It seems like it would be a useful method to have.
Adit
2010年5月3日 Johan Grönqvist <joh...@gm...>
> 2010年05月02日 20:19, aditya bhargava skrev:
> > Is there a straightforward way of plotting a vector in matplotlib?
> > Suppose I want to plot the vector [1 2]'. If I pass this vector in to
> > plot(), I get the line that passes through (0,1), (1,2). Instead I want
> > the line that passes through (0,0),(1,2).
> >
>
> I use pyplot.Arrow to visualize displacement fields.
>
> This is a snippet copied from the code I use (it sits in a loop over all
> vectors I want to plot):
>
>
> arr = plt.Arrow(x, y, dx, dy)
> plt.gca().add_patch(arr)
>
> In your case, you would have (x, y) = (0, 0) and (dx, dy) = (1, 2).
>
> Regards
>
> Johan
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
-- 
wefoundland.com

Showing 22 results of 22

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 によって変換されたページ (->オリジナル) /