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





Showing results of 318

<< < 1 .. 5 6 7 8 9 .. 13 > >> (Page 7 of 13)
From: Joshua J. K. <jo...@ee...> - 2007年04月12日 01:16:03
On Wednesday 11 April 2007 15:49, Eric Firing wrote:
> It is a bug that is fixed in svn. The "this" part of the names is
> incorrect. The revised function is:
>
>
> def xaxis_date(self, tz=None):
> """Sets up x-axis ticks and labels that treat the x data as dates.
>
> tz is the time zone to use in labeling dates. Defaults to rc
> value.
> """
>
> locator = self.xaxis.get_major_locator()
> if not isinstance(locator, DateLocator):
> locator = AutoDateLocator(tz)
> self.xaxis.set_major_locator(locator)
>
> formatter = self.xaxis.get_major_formatter()
> if not isinstance(formatter, DateFormatter):
> formatter = AutoDateFormatter(locator)
> self.xaxis.set_major_formatter(formatter)
>
>
> Similarly for yaxis_date.
Thank you! That did the trick!
j
-- 
Joshua Kugler 
Lead System Admin -- Senior Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/ ID 0xDB26D7CE
PO Box 80086 -- Fairbanks, AK 99708 -- Ph: 907-456-5581 Fax: 907-456-3111
From: belinda t. <bt...@cs...> - 2007年04月12日 00:09:30
On Apr 11, 2007, at 4:47 PM, belinda thom wrote:
> Hi,
>
> I'm replying to this older thread
>
> http://www.mail-archive.com/mat...@li.../ 
> msg02100.html
>
> because it relates very much to my recent problem, posted at http:// 
> www.mail-archive.com/mat...@li.../ 
> msg03037.html. This problem seems more general than just the two 
> circumstances you mentioned.
>
> I'm finding the problem w/any use plot3D in matplotlib.axes3d, e.g.:
FYI: It also is a problem when using plot3d
--b
From: belinda t. <bt...@cs...> - 2007年04月12日 00:08:29
On Apr 11, 2007, at 4:54 PM, belinda thom wrote:
> Hi,
>
> What kwargs are available for plot3D and scatter3D?
And what is the difference between plot3d and plot3D?
The former seems most "matlab" like, and was what I was looking for: 
a way to plot individual points and/or curves in 3d using matlab- 
style line formatting info like:
'ro-'
or
'go--'
I'm posting this discovery here b/c it took me a long time to find 
(from the cookbook I somehow started using plot3D and didn't realize 
there was a plot3d).
I am still unsure what args you can pass into plot3D and scatter3D to 
achieve similar line control. If there's a high-level place this 
stuff is described, it would be beneficial.
From: belinda t. <bt...@cs...> - 2007年04月11日 23:54:04
Hi,
What kwargs are available for plot3D and scatter3D?
Thanks,
--b
From: Eric F. <ef...@ha...> - 2007年04月11日 23:50:15
It is a bug that is fixed in svn. The "this" part of the names is 
incorrect. The revised function is:
 def xaxis_date(self, tz=None):
 """Sets up x-axis ticks and labels that treat the x data as dates.
 tz is the time zone to use in labeling dates. Defaults to rc 
value.
 """
 locator = self.xaxis.get_major_locator()
 if not isinstance(locator, DateLocator):
 locator = AutoDateLocator(tz)
 self.xaxis.set_major_locator(locator)
 formatter = self.xaxis.get_major_formatter()
 if not isinstance(formatter, DateFormatter):
 formatter = AutoDateFormatter(locator)
 self.xaxis.set_major_formatter(formatter)
Similarly for yaxis_date.
Eric
Joshua J. Kugler wrote:
> We had some working code were were using with 0.87, but when we try to use it 
> with 0.90, we get the following error:
> 
> File "/usr/local/lib/python2.4/site-packages/EEIGraph/BaseGraph.py", line 250, 
> in plotDate
> line = self.main_axes.plot_date( g[:,0], g[:,1] )
> 
> File "/usr/lib/python2.4/site-packages/matplotlib-0.90.0-py2.4-linux-i686.egg/matplotlib/axes.py", 
> line 2395, in plot_date
> self.xaxis_date(tz)
> 
> File "/usr/lib/python2.4/site-packages/matplotlib-0.90.0-py2.4-linux-i686.egg/matplotlib/axes.py", 
> line 1564, in xaxis_date
> formatter = AutoDateFormatter(locator)
> UnboundLocalError: local variable 'locator' referenced before assignment
> 
> It happens in this function:
> 
> def xaxis_date(self, tz=None):
> """Sets up x-axis ticks and labels that treat the x data as dates.
> 
> tz is the time zone to use in labeling dates. Defaults to rc value.
> """
> 
> thislocator = self.xaxis.get_major_locator()
> if not isinstance(thislocator, DateLocator):
> locator = AutoDateLocator(tz)
> self.xaxis.set_major_locator(locator)
> 
> thisformatter = self.xaxis.get_major_formatter()
> if not isinstance(thisformatter, DateFormatter):
> formatter = AutoDateFormatter(locator)
> self.xaxis.set_major_formatter(formatter)
> 
> It seems to happen when thislocator is an AutoDateLocator, thus locator is an 
> AutoDateLocator, thus locator is not set, but thisformatter is a 
> AutoDateFormatter, which doesn't seem to satisfy isinstance(thisformatter, 
> DateFormatter)
> 
> I don't know enough about matplotlib internals to speculate further.
> 
> Any hints?
> 
> j
> 
From: belinda t. <bt...@cs...> - 2007年04月11日 23:47:06
Hi,
I'm replying to this older thread
http://www.mail-archive.com/mat...@li.../ 
msg02100.html
because it relates very much to my recent problem, posted at http:// 
www.mail-archive.com/mat...@li.../ 
msg03037.html. This problem seems more general than just the two 
circumstances you mentioned.
I'm finding the problem w/any use plot3D in matplotlib.axes3d, e.g.:
import copy
import pylab as P
import matplotlib.axes3d as P3
fig = P.figure()
ax = P3.Axes3D(fig)
ax.plot3D(P.ravel(X),P.ravel(Y),P.ravel(Z)) # this command will fail
with the errors identical to those you report. I modified 
matplotlib's axis.py in a similar way as your suggestion. Line 2131 
went from:
self.autoscale_view(scalex=scalex,scaley=scaley)
to:
self.autoscale_view() #scalex=scalex,scaley=scaley)
It took me a while to verify that this fixed the problem b/c I didn't 
at first realize I'd have to kill ipython and restart it (so that it 
sees the new axes.py file).
I wonder what this change to axes.py will break. Any ideas?
Thx,
--b
From: Christopher B. <Chr...@no...> - 2007年04月11日 23:40:17
Hi all,
I've got the MPL 0.90.0 installer on pythonmac working OK with:
Python2.5
wxPython2.8.3
I accomplished this by removing:
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/backends/_wxagg.so
Which disables the accelerator that doesn't work with wxPython 2.8
What we really need to do is get Ken's changes into a release, but I 
have my immediate needs met.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Joshua J. K. <jo...@ee...> - 2007年04月11日 23:19:19
We had some working code were were using with 0.87, but when we try to use it 
with 0.90, we get the following error:
File "/usr/local/lib/python2.4/site-packages/EEIGraph/BaseGraph.py", line 250, 
in plotDate
 line = self.main_axes.plot_date( g[:,0], g[:,1] )
 
File "/usr/lib/python2.4/site-packages/matplotlib-0.90.0-py2.4-linux-i686.egg/matplotlib/axes.py", 
line 2395, in plot_date
 self.xaxis_date(tz)
 
File "/usr/lib/python2.4/site-packages/matplotlib-0.90.0-py2.4-linux-i686.egg/matplotlib/axes.py", 
line 1564, in xaxis_date
 formatter = AutoDateFormatter(locator)
UnboundLocalError: local variable 'locator' referenced before assignment
It happens in this function:
 def xaxis_date(self, tz=None):
 """Sets up x-axis ticks and labels that treat the x data as dates.
 tz is the time zone to use in labeling dates. Defaults to rc value.
 """
 thislocator = self.xaxis.get_major_locator()
 if not isinstance(thislocator, DateLocator):
 locator = AutoDateLocator(tz)
 self.xaxis.set_major_locator(locator)
 thisformatter = self.xaxis.get_major_formatter()
 if not isinstance(thisformatter, DateFormatter):
 formatter = AutoDateFormatter(locator)
 self.xaxis.set_major_formatter(formatter)
It seems to happen when thislocator is an AutoDateLocator, thus locator is an 
AutoDateLocator, thus locator is not set, but thisformatter is a 
AutoDateFormatter, which doesn't seem to satisfy isinstance(thisformatter, 
DateFormatter)
I don't know enough about matplotlib internals to speculate further.
Any hints?
j
-- 
Joshua Kugler 
Lead System Admin -- Senior Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/ ID 0xDB26D7CE
PO Box 80086 -- Fairbanks, AK 99708 -- Ph: 907-456-5581 Fax: 907-456-3111
From: belinda t. <bt...@cs...> - 2007年04月11日 23:16:27
I also seem to have some other 3D plotting problems. Again, following 
some of the demo/test advice in the cookbook, I tried things like
 import pylab as p
 import matplotlib.axes3d as P3
 P3.test_surface()
and get errors (seems Axes3D needs a figure, no?).
I'm using matplotlib version 0.87.7.
Any ideas?
Thx,
--b
In [49]: P3.test_surface()
------------------------------------------------------------------------ 
---
exceptions.TypeError Traceback (most 
recent call last)
/Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ 
<ipython console>
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/matplotlib/axes3d.py in test_surface()
 739
 740 def test_surface():
--> 741 ax = Axes3D()
 742
 743 X,Y,Z = get_test_data(0.05)
TypeError: __init__() takes at least 2 arguments (1 given)
 > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/axes3d.py(741)test_surface()
 740 def test_surface():
--> 741 ax = Axes3D()
 742
ipdb>
In [50]: P3.test_surface?
Type:		function
Base Class:	<type 'function'>
String Form:	<function test_surface at 0x304a070>
Namespace:	Interactive
File:		/Library/Frameworks/Python.framework/Versions/2.4/lib/ 
python2.4/site-packages/matplotlib/axes3d.py
Definition:	P3.test_surface()
Docstring:
 <no docstring>
In [51]: P3.test_surface()
------------------------------------------------------------------------ 
---
exceptions.TypeError Traceback (most 
recent call last)
/Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ 
<ipython console>
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/matplotlib/axes3d.py in test_surface()
 739
 740 def test_surface():
--> 741 ax = Axes3D()
 742
 743 X,Y,Z = get_test_data(0.05)
TypeError: __init__() takes at least 2 arguments (1 given)
 > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/axes3d.py(741)test_surface()
 740 def test_surface():
--> 741 ax = Axes3D()
 742
ipdb>
In [52]: P3.test_contour()
------------------------------------------------------------------------ 
---
exceptions.TypeError Traceback (most 
recent call last)
/Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ 
<ipython console>
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/matplotlib/axes3d.py in test_contour()
 750
 751 def test_contour():
--> 752 ax = Axes3D()
 753
 754 X,Y,Z = get_test_data(0.05)
TypeError: __init__() takes at least 2 arguments (1 given)
 > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/axes3d.py(752)test_contour()
 751 def test_contour():
--> 752 ax = Axes3D()
 753
ipdb> 
From: belinda t. <bt...@cs...> - 2007年04月11日 22:35:22
Hi,
I'm having problems plotting two different kind of graphs on the same 
3D figure. Was hoping for some pointers.
Here's some basic test code, to demonstrate what I'd like to be able 
to do.
------------
import copy
import pylab as P
import matplotlib.axes3d as P3
def test() :
 [X,Y] = P.meshgrid(P.linspace(-3,3,7),P.linspace(-3,3,7))
 Z = copy.deepcopy(X)
 Z1 = copy.deepcopy(X)
 for i in xrange(len(X)) :
 for j in xrange(len(X[0])) :
 Z[i][j] = X[i][j]*Y[i][j]
 Z1[i][j] = X[i][j]*Y[i][j] - 5
 P.close('all')
 fig = P.figure()
 ax = P3.Axes3D(fig)
 ax.scatter3D(P.ravel(X),P.ravel(Y),P.ravel(Z))
 ax.set_xlabel('x')
 ax.set_ylabel('y')
 ax.set_zlabel('z=x*y')
 P.show()
 ax.plot3D(P.ravel(X),P.ravel(Y),P.ravel(Z1))
 P.show()
------------
Which produces an autoscale_view kwarg error appended below. I've 
tried calling plot3D with scalex=False and scaleY=False but that 
doesn't fix the problem. I've also tried creating a new axis (e.g. 
ax1) and doing ax1.Plot3D to no avail. It seems to be an error w/in 
matplotlib, but perhaps I'm misusing something. I haven't been able 
to find much documentation for this at http://www.scipy.org/Cookbook/ 
Matplotlib/mplot3D so have resorted to playing around.
If anyone also knows how to pass color-marker info into scatter3D, I 
have been able to create two of those on the same figure, so being 
able to change the colors of each and just using scatter3D would be a 
reasonable hack for my situation.
Advice always appreciated,
--b
In [25]: T.test()
------------------------------------------------------------------------ 
---
exceptions.TypeError Traceback (most 
recent call last)
/Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ 
<ipython console>
/Users/bthom/belinda/mills/aicourse/material/week12/lec/examples/ 
threeD.py in test()
 18 ax.set_zlabel('z=x*y')
 19 P.show()
---> 20 ax.plot3D(P.ravel(X),P.ravel(Y),P.ravel(Z1))
 21 P.show()
 22
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/matplotlib/axes3d.py in plot3D(self, xs, ys, zs, *args, 
**kwargs)
 488 def plot3D(self, xs, ys, zs, *args, **kwargs):
 489 had_data = self.has_data()
--> 490 lines = Axes.plot(self, xs,ys, *args, **kwargs)
 491 if len(lines)==1:
 492 line = lines[0]
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
packages/matplotlib/axes.py in plot(self, *args, **kwargs)
 2129 lines = [line for line in lines] # consume the 
generator
 2130
-> 2131 self.autoscale_view(scalex=scalex, scaley=scaley)
 2132 return lines
 2133
TypeError: autoscale_view() got an unexpected keyword argument 'scalex'
 > /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/ 
site-packages/matplotlib/axes.py(2131)plot()
 2130
-> 2131 self.autoscale_view(scalex=scalex, scaley=scaley)
 2132 return lines
From: Joshua J. K. <jo...@ee...> - 2007年04月11日 22:01:00
On Thursday 05 April 2007 17:04, Andrew Straw wrote:
> Joshua J. Kugler wrote:
> > Installing an egg today, I got this message from easy_install:
> >
> > /usr/bin/easy_install:5: UserWarning: Module dateutil was already
> > imported from
> > /usr/lib/python2.4/site-packages/matplotlib-0.87.7-py2.4-linux-i686.egg/d
> >ateutil/__init__.pyc, but
> > /usr/lib/python2.4/site-packages/python_dateutil-1.1-py2.4.egg is being
> > added to sys.path
> > from pkg_resources import load_entry_point
> >
> > Investigating, it seems that Matplotlib includes python-dateutils
> > wholesale in its egg, instead of depending on the python-dateutils egg
> > and installing that, thus generating warning messages like these.
>
> Where did you get that matplotlib egg? Particularly on linux (which you
> appear to be using), distributing .eggs for matplotlib would be
> problematic because of all the 3rd party libraries required, so I didn't
> think they'd be officially distributed. Indeed, I don't see one for
> linux on the matplotlib download page.
I create it myself using the supplied setupegg.py script.
> > Would be possible to
> > remove the dateutil module from future matplotlib eggs and simply rely on
> > the python-dateutils egg?
>
> Since matplotlib doesn't require setuptools (other than for Python 2.3),
> there can be no install_requires field. (And even if we had it in the
> install_requires field, does your linux distribution's python-dateutil
> package include the egg info required for the install_requires field to
> work?)
Gotcha.
> If you built the egg yourself, you can re-build it with dateutil
> installed and then matplotlib's setup.py file won't include its own
> dateutil. Ditto for pytz.
Thanks for the tip! Installed pytz and dateutil, and the created egg is what 
I desired. Thanks!
j
-- 
Joshua Kugler 
Lead System Admin -- Senior Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/ ID 0xDB26D7CE
PO Box 80086 -- Fairbanks, AK 99708 -- Ph: 907-456-5581 Fax: 907-456-3111
From: Archana G. <arc...@gm...> - 2007年04月11日 19:27:45
Hi Werner,
I tried what you suggested, using the setup file you had provided for
simple_plot.py. But I get the following error, what should I do abt this?
Traceback (most recent call last):
 File "simple_plot.py", line 1, in ?
 File "pylab.pyo", line 1, in ?
 File "matplotlib\pylab.pyo", line 203, in ?
 File "matplotlib\axes.pyo", line 16, in ?
 File "matplotlib\axis.pyo", line 19, in ?
 File "matplotlib\patches.pyo", line 42, in ?
 File "matplotlib\patches.pyo", line 79, in Patch
 File "matplotlib\cbook.pyo", line 352, in dedent
AttributeError: 'NoneType' object has no attribute 'splitlines'
Could you please tell me what I should do?
Thanks a lot,
Archana.
On 4/9/07, Werner F. Bruhin <wer...@fr...> wrote:
>
> Hi Emmanuel,
>
> Maybe your problem has to do with your "enthought" build of wxPython. I
> use standard builds from wxPython site.
>
> Emmanuel wrote:
> > when putting the full path of wxmsw26u_vc_enthought.dll in setup.py
> > like this
> >
> > data_files = [("lib\\matplotlibdata", mpfiles),
> > matplotlib.get_py2exe_datafiles(), # if you don't
> > use the lib option
> You get two copies of matplotlibdata as you kept both of the two above
> lines active. You need to use the first one of you use the py2exe
> option to create a library.zip which I put into a sub-folder called
> 'lib' in the sample setup.py file.
> > "C:\\Python24\\Lib\\site-packages\\wx-
> 2.6.1.0-py2.4-win32.egg\\wx\\wxmsw26u_vc_enthought.dll",
> > ## "wxmsw26u_vc_enthought.dll",
> > #### ("prog\\", python4dll)
> > ]
> >
> You are also using an 'egg'. I seem to recall that py2exe does not yet
> really support that, but you might want to check on the py2exe list
> (e.g. on the gmane mirror of it at
> http://dir.gmane.org/gmane.comp.python.py2exe
>
> Werner
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
From: Maddox F. <mad...@we...> - 2007年04月11日 17:07:57
Jouni K. Seppänen wrote:
> Make the legend first with only the line, then modify the line within
> the legend:
> 
> from numpy import arange, sin
> x = arange( 0., 1., 0.001 )
> y = sin( 50*x )
> line = plot(x, y, '-r')
> markers = plot(x[::20], y[::20], 'ro')
> lgd = legend([line], ['data'], numpoints=3)
> lgd.get_lines()[0].set_marker('o')
> draw()
Thanks, that's exactly what I wanted! Cheers, Maddox
From: Christopher B. <Chr...@no...> - 2007年04月11日 16:12:47
bre...@un... wrote:
> I edited the matplotlibrc to interactive: False and backend: Agg, and it 
> works great. (produces .png)
no need. as the name implies, TKagg is already using agg internally, so 
you can just use pylab.savefig (or better yet, figure.savefig), and get 
the same high quality PNG. No need to switch back-ends. The plain Agg 
back-end is there for things like web apps, where you may not be able to 
run a GUI at all.
-Chris
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: John H. <jd...@gm...> - 2007年04月11日 14:55:55
On 4/11/07, Maddox Flower <mad...@we...> wrote:
> Hi there,
>
> say, I have x and y data like this (the real data I am working with is
> from numerical simulations, though):
>
> from numpy import arange, sin
> x = arange( 0., 1., 0.001 )
> y = sin( 50*x )
>
> Now, a line plot would not look very decent because of the 1000
> overlapping markers:
>
> plot(x, y, '-ro')
>
> Now, I'd rather have the same plot with a marker symbol only every 20th
> data point. Of course, I can easily achieve this by slicing through my
> data set and making two plots, one for the line and another one for the
> markers:
>
> line = plot(x, y, '-r')
> markers = plot(x[::20], y[::20], 'ro')
>
> Note that just doing a plot(x[::20],y[::20],'-ro') would 'distort' the
> plot because the markers are being linked by straight lines.
>
> What fails me is how to make a legend with the appropriate 'combined'
> line style '-ro'? I have tried to supply the legend statement with that
> linestyle:
>
> legend( ['-ro'], ['data'] )
>
> but it really expects a list of line instances, so that did not work.
You can create a proxy line object that you do not plot
from matplotlib.lines import Line2D
line = Line2D(range(10), range(10), linestyle='-', marker='o')
legend((line,), (label,))
You will need to make sure that your proxy line has the same
properties as the line you are trying to legend.
From: <jk...@ik...> - 2007年04月11日 14:42:46
Maddox Flower <mad...@we...> writes:
> What fails me is how to make a legend with the appropriate 'combined'
> line style '-ro'?
Make the legend first with only the line, then modify the line within
the legend:
from numpy import arange, sin
x = arange( 0., 1., 0.001 )
y = sin( 50*x )
line = plot(x, y, '-r')
markers = plot(x[::20], y[::20], 'ro')
lgd = legend([line], ['data'], numpoints=3)
lgd.get_lines()[0].set_marker('o')
draw()
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: Maddox F. <mad...@we...> - 2007年04月11日 12:22:55
Hi there,
say, I have x and y data like this (the real data I am working with is
from numerical simulations, though):
from numpy import arange, sin
x = arange( 0., 1., 0.001 )
y = sin( 50*x )
Now, a line plot would not look very decent because of the 1000
overlapping markers:
plot(x, y, '-ro')
Now, I'd rather have the same plot with a marker symbol only every 20th
data point. Of course, I can easily achieve this by slicing through my
data set and making two plots, one for the line and another one for the
markers:
line = plot(x, y, '-r')
markers = plot(x[::20], y[::20], 'ro')
Note that just doing a plot(x[::20],y[::20],'-ro') would 'distort' the
plot because the markers are being linked by straight lines.
What fails me is how to make a legend with the appropriate 'combined'
line style '-ro'? I have tried to supply the legend statement with that
linestyle:
legend( ['-ro'], ['data'] )
but it really expects a list of line instances, so that did not work.
Thanks for your suggestions,
Maddox
From: Pierre GM <pgm...@gm...> - 2007年04月11日 08:27:04
On Wednesday 11 April 2007 03:28:09 elekis wrote:
Hi,
Just some quick comments:
1. learn list comprehensions, they're far faster than regular loops.
data = [(i,j,int(numpy.random.random()*10))
 for i in range(XI) for j in range(JI)]
2. if you don't really need the triplets, but just the random part, just use:
Z = (numpy.random.random(XI*YI)*10).astype(int).reshape(Xl,Yl)
3. It's more efficient to use numpy.empty than numpy.zeros to initialize an 
array you're going to fill afterwards.
4. You may have found a bug in plot_wireframe, actually. The code doesn't look 
quite right. My understanding is that the 3d part is not really supported, 
either...
Hope it helps.
From: massimo s. <mas...@un...> - 2007年04月11日 08:19:42
Attachments: massimo.sandal.vcf
bre...@un... ha scritto:
> The question is, do people wanting to do this have to edit the 
> matplotlibrc and restart Python each time, or is there some other way?
Try to look for savefig()
m.
-- 
Massimo Sandal
University of Bologna
Department of Biochemistry "G.Moruzzi"
snail mail:
Via Irnerio 48, 40126 Bologna, Italy
email:
mas...@un...
tel: +39-051-2094388
fax: +39-051-2094387
From: elekis <el...@gm...> - 2007年04月11日 07:28:10
hi all
I have a little script who just plot some tripet (random triplet) but I have
a index out of bound
What I don't understand is if Xl is diff of Yl , I have that error
Traceback (most recent call last):
 File "test_plot3D.py", line 26, in <module>
 ax.plot_wireframe(X, Y, Z)
 File "/usr/lib/python2.5/site-packages/matplotlib/axes3d.py", line 562, in
plot_wireframe
 txlines = [tX[i] for i in cii]
IndexError: index out of bounds
if there equals, all is perfect, but I haven't that.
there is the script
import numpy
import pylab as p
import matplotlib.axes3d as p3
import random
data = []
Xl = 10
Yl = 40 #if Yl = Xl , all is ok
#create data
for i in range(Xl):
 for j in range(Yl):
 data.append( (i,j,int( random.random()*10 ) ) )
X, Y = numpy.meshgrid(p.arange(0, Xl, 1), p.arange(0, Yl, 1))
Z = numpy.zeros( (Xl, Yl) )
for d in data:
 x, y, z = d
 Z[x, y] = z
fig = p.figure()
ax = p3.Axes3D(fig)
ax.plot_wireframe(X, Y, Z)
p.show()
any help.
thanks.
a++
From: <jk...@ik...> - 2007年04月11日 05:11:03
Iyer <mas...@ya...> writes:
> With all respect, I have certainly perused the
> tutorials before posting the question. 
>From your postings it seems that you are misunderstanding some
fundamental concepts, but it is not clear how. Can you write up a
little piece of code showing what you are doing now, and explain how
you would like the output changed? Just make up some data and plot it,
and point out what is wrong about the result.
As an example of how to phrase your question, here is how I would
write the question I thought you were trying to communicate a few
emails ago:
 ----------------------------------------------------------------------
 The following script makes an otherwise good plot, but I want the
 x-axis to go from 0 to 1, not 0 to 10. How do I do this?
 x = arange(0,10,0.5)
 y = sin(x)
 plot(x,y)
 ----------------------------------------------------------------------
The best answer to *that* question, which you got from John Hunter, is
to change the script to the following:
 x = arange(0,10,0.5)
 y = sin(x)
 dt = 1.0/10
 plot(x*dt,y)
Since you say that this does not solve your problem, that must not
have been the question you intended to ask. Perhaps rephrasing the
question using a code example would help make your point clearer.
-- 
Jouni K. Seppänen
http://www.iki.fi/jks
From: <bre...@un...> - 2007年04月11日 00:11:47
Just started using matplotlib (it's great!) interactively (using ipython, 
TkAgg backend) and am moving into saving plots to file.
I edited the matplotlibrc to interactive: False and backend: Agg, and it 
works great. (produces .png)
I would normally like to muck around interactively to get the plot right, 
then save it to png once I'm happy with it.
The question is, do people wanting to do this have to edit the 
matplotlibrc and restart Python each time, or is there some other way?
editorial: What a great combination is Python and matplotlib!
Thanks.
UNITED GROUP
This email message is the property of United Group. The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorised. If you are not the intended recipient, you may not disclose, copy or distribute this email, nor take or omit to take any action in reliance on it. United Group accepts no liability for any damage caused by this email or any attachments due to viruses, interference, interception, corruption or unauthorised access.
If you have received this email in error, please notify United Group immediately by email to the sender's email address and delete this document.
From: John H. <jd...@gm...> - 2007年04月10日 21:13:50
On 4/10/07, Iyer <mas...@ya...> wrote:
> If only someone could guide me, so that I can
> understand better how to "translate" the ticks from
> the default "number of sample" ticks to that of
> different ticks - say
> new_ticks=original_ticks/(some_constant). Right now
> I'm clueless, your input will help a lot in
> understanding Mpl.
OK, your persistence is admirable. You are still asking the wrong
question and applying the wrong solution, but dog-golly, you've earned
the right to do it the wrong way!
from matplotlib.ticker import FuncFormatter
def myformatter(x, pos=None):
 return '%1.3f'%(x/4.)
ax = subplot(111)
ax.plot(x, y)
ax.xaxis.set_major_formatter(FuncFormatter(myformatter))
Now all your ticks are magically divided by 4.
But really, simply scaling your x input data is the way to go. If we
want to move this conversation forward, you should try instead
 plot(x/4, y)
and then explain as clearly as possibly this doesn't do what you want.
From: Iyer <mas...@ya...> - 2007年04月10日 21:03:09
With all respect, I have certainly perused the
tutorials before posting the question. I'm still a
newbie and I acknowledge I have miles and miles to go
before I can be someone who can help out in the
Matplotlib group like you guys do.
The problem is simple, it is like the date examples in
the Matplotlib code -- the ticks for the date examples
(seconds, hours, time etc) are different from the
usual ticks, which is usually the number of samples.
If only someone could guide me, so that I can
understand better how to "translate" the ticks from
the default "number of sample" ticks to that of
different ticks - say
new_ticks=original_ticks/(some_constant). Right now
I'm clueless, your input will help a lot in
understanding Mpl.
Thanks guys for your feedback and help
iyer
--- Eric Firing <ef...@ha...> wrote:
> There seems to be a huge misunderstanding here, and
> I am not sure what 
> it is, but what you need to do is run examples and
> experiment with 
> variations until you have some inkling of what mpl
> is actually doing. 
> Start with 
> http://matplotlib.sourceforge.net/tutorial.html.
> 
> Please note that the ticks are simply labeled
> locations--they have no 
> effect on what data are plotted.
> 
> When you do ax.plot(ind*dt, y), absolutely *nothing*
> is lost; every 
> value of y in your array is plotted. mpl is plotting
> (x,y) pairs--all of 
> them--and labeling the axes accordingly.
> 
> To see what is being plotted, you can use
> plot(x,y,'ro'), for example, 
> to plot each point as a red circle. Experiment with
> this.
> 
> Don't worry right now about avoiding the pylab
> interface; take advantage 
> of its simplicity to get the most basic plotting
> concepts straightened 
> out via quick experimentation. Use the gui zoom
> button to see how axis 
> labeling works. Make your own simple examples; plot
> random points, plot 
> sin waves.
> 
> Eric
> 
> Iyer wrote:
> > It is not what I need..
> > 
> >
>
http://matplotlib.sourceforge.net/matplotlib.axes.html
> > 
> > The plot method (plot(self, *args, **kwargs))
> accepts
> > only x,y pairs, in ax.plot(ind*dt, y) -- the x
> > parameter is ind*dt - the sample times, but the
> data
> > between the sample points is lost. IMHO, the
> likely
> > way to prevent loss of sampled data points is
> changing
> > the ticks, isn't that possible to change the
> ticks,
> > while keeping the data as it is -- plotted as if
> it
> > were for a number of data points.
> > 
> > -iyer
> > 
> > 
> > 
> > 
> > --- John Hunter <jd...@gm...> wrote:
> > 
> >> On 4/10/07, John Hunter <jd...@gm...>
> wrote:
> >>> On 4/10/07, Iyer <mas...@ya...> wrote:
> >>>> I apologize if I haven't been sufficiently
> >> clear.
> >>>> While your suggestion picks out the samples
> from
> >> the
> >>>> sample set, and discards other samples - what I
> >> was
> >>>> looking at --
> >> My suggestion does not "discard other samples",
> so
> >> you may not be
> >> understanding what I am saying. Perhaps you can
> try
> >> the suggested
> >> code and see if it does what you want. My
> example
> >> plots all the
> >> samples; it simply scales the xaxis to represent
> >> time and not sample
> >> number.
> >>
> > 
> > 
> > 
> > 
> >
>
____________________________________________________________________________________
> > Looking for earth-friendly autos? 
> > Browse Top Cars by "Green Rating" at Yahoo! Autos'
> Green Center.
> > http://autos.yahoo.com/green_center/
> > 
> >
>
-------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of
> IT
> > Join SourceForge.net's Techsay panel and you'll
> get the chance to share your
> > opinions on IT & business topics through brief
> surveys-and earn cash
> >
>
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > _______________________________________________
> > Matplotlib-users mailing list
> > Mat...@li...
> >
>
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 
 
____________________________________________________________________________________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 
From: Eric E. <ems...@ob...> - 2007年04月10日 18:37:14
Hi,
a problem that I have since some time now using mpl: everytime I start
plotting, I get something like:
(python:6374): GnomePrintCupsPlugin-WARNING **: iconv does not support
ppd character encoding: ISOLatin1, trying CSISOLatin1
I know this is not really a mpl problem, but if anybody has a clue, it
is welcome!
cheers
Eric
matplotlib version 0.87.7
verbose.level helpful
interactive is False
platform is linux2
numerix numpy 1.0.2.dev3534
font search path
['/usr/local/lib/python2.4/site-packages/matplotlib/mpl-data']
backend WXAgg version 2.6.2.1
Python 2.4.2 (#1, May 2 2006, 08:13:46)
on Suse 10.1.
1 message has been excluded from this view by a project administrator.

Showing results of 318

<< < 1 .. 5 6 7 8 9 .. 13 > >> (Page 7 of 13)
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 によって変換されたページ (->オリジナル) /