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





Showing results of 313

1 2 3 .. 13 > >> (Page 1 of 13)
From: John H. <jdh...@ac...> - 2006年07月31日 20:57:46
>>>>> "David" == David Huard <dav...@gm...> writes:
 David> Hi, I have a function fig(x) that returns a subplot
 David> instance, and I'd like to make a new figure by calling this
 David> function twice.
 David> For example: def fig(x): s = subplot(111) return s.plot(x)
 David> and i wan't to do something like:
 David> fig = figure(figsize = (6,12)) fig.add_axes(fig(x1))
 David> fig.add_axes(fig(x2))
 David> ax1, ax2 = fig.get_axes() ax1.set_position([.125, .5, .75,
 David> .4])
 David> But it looks like the position is not understood relative
 David> to the new figure size, so it doesn't work. Should it or
 David> is there a better way to do that ?
There are lots of problems with your code that makes it hard to
understand what you are trying to do. Let's get some terminology
straight by way of commenting your code, then maybe you can describe
what you really want to do
def fig(x):
 # subplot creates an Axes instance on a regular grid; it will add
 # this Axes to the current Figure, and if no Figure exists, it will
 # create on. If a current Figure exists, and you have already
 # created an Axes in it with subplot(111), this call simply makes
 # the Axes the current Axes. Technically, it creates a Subplot,
 # which is derived from Axes
 s = subplot(111)
 # plot returns a list of Line2D objects, and so the function "fig"
 # is returning a list of lines
 return s.plot(x)
# this call creates a Figure instance
fig = figure(figsize = (6,12))
# add_axes is used to add an Axes to the figure. It expects either an
# Axes instance, or a rectangle determined by [left, bottom, width,
# height]. You are passing it a list of lines, as noted above
fig.add_axes(fig(x1))
fig.add_axes(fig(x2))
# this returns a list of axes
ax1, ax2 = fig.get_axes()
# this sets the rectangle for the first Axes 
ax1.set_position([.125, .5, .75, .4])
OK, now that we have some terminology down and hopefully you can see
why you are failing, I'll try and guess what you want. You want to
add an Axes to the current figure, and have them stacked one above the
other. So on the first call, you basically have subplot(111), and on
the second call, you have two subplots, subplot(211) and subplot(212).
Something like
from pylab import figure, show
def pushax(fig, x):
 n = len(fig.axes)
 for i, ax in enumerate(fig.axes):
 print 'new gemo', n+1,1,i+1
 ax.change_geometry(n+1,1,i+1)
 ax = fig.add_subplot(n+1, 1, n+1)
 ax.plot(x)
fig = figure()
pushax(fig, [1,2,3,4])
pushax(fig, [1,4,9,16])
show()
See also the devel list, where Andrew Straw recently added a "Sizer"
model along the lines of wx sizers for axes placement.
Or I may have misunderstood what you want to do....
JDH
From: Chris S <chr...@gm...> - 2006年07月31日 20:36:11
Thanks, that's exactly what I was looking for.
Chris
On 7/31/06, Richard Albright <ral...@in...> wrote:
> take a look at the finance_work2.py code on the screenshots page:
> http://matplotlib.sourceforge.net/screenshots.html
>
> On Mon, 2006年07月31日 at 11:52 -0400, Chris S wrote:
> > I'm trying to plot dates using plot_date(), but the date for every
> > point is labeled on the axis, and in a verbose format, resulting in a
> > jumble of text making the date-axis completely unreadable. Is there
> > any way to control the format of the dates displayed, and ensure only
> > a small percentage of points are labeled on the axis?
> >
> > Chris
> >
> > -------------------------------------------------------------------------
> > 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
> --
> Rick Albright
> Senior Quantitvative Analyst
> Indie Research, LLC
> 254 Witherspoon Street
> Princeton, NJ 08542
> (609)497-1030
> ral...@in...
>
>
>
From: David H. <dav...@gm...> - 2006年07月31日 20:34:39
Hi,
I have a function fig(x) that returns a subplot instance,
and I'd like to make a new figure by calling this function twice.
For example:
def fig(x):
 s = subplot(111)
 return s.plot(x)
and i wan't to do something like:
fig = figure(figsize = (6,12))
fig.add_axes(fig(x1))
fig.add_axes(fig(x2))
ax1, ax2 = fig.get_axes()
ax1.set_position([.125, .5, .75, .4])
But it looks like the position is not understood relative to the new figure
size, so it doesn't work.
Should it or is there a better way to do that ?
Thanks,
David
From: PGM <pgm...@gm...> - 2006年07月31日 20:17:47
Chris,
http://matplotlib.sourceforge.net/matplotlib.pylab.html#-plot_date
+
google "date dateutils" site:http://matplotlib.sourceforge.net/tutorial.html
+
http://matplotlib.sourceforge.net/matplotlib_examples_0.87.1.zip
And if this is not enough, please be a bit more specific in your request: an 
example of code you typed and better description of wehat you expected would 
do.
Thx
P.
From: Alexander M. <lxa...@gm...> - 2006年07月31日 19:20:09
I would like to create a plot axis with major tick labels centered *between*
major tick markers instead below tick markers. If you are viewing this email
with a fixed-width font, it might look something like:
|___.___.___.___|___.___.___.___|___.___.___.___|
 LABEL01 LABEL02 LABEL03
Ideally and ambitiously I would like both minor and major labels to be
displayed stacked and boxed like:
|___.___.___.___|___.___.___.___|___.___.___.___|
|_1_|_2_|_3_|_4_|_1_|_2_|_3_|_4_|_1_|_2_|_3_|_4_|
|____LABEL01____|____LABEL02____|____LABEL03____|
I've been poking around a bit through the examples, the mailing list and the
source code, but haven't quite figured out how to carry out this
customization. So far, I have created my own Locator and Formatter, but I
have yet to figure out where I can calculate the label locations or put
boxes around them.
Your thoughts appreciated,
Alex
From: John H. <jdh...@ac...> - 2006年07月31日 18:04:49
>>>>> "Eric" == Eric Firing <ef...@ha...> writes:
 Eric> thread. I would like to remove it, together with
 Eric> copy_bbox_transform, on the grounds that these functions
 Eric> probably have not been used by anyone except during the last
 Eric> few days, and their functionality is available in a much
 Eric> more general way via the Transformation deepcopy and
 Eric> shallowcopy methods.
 Eric> Any objections?
+1
Just make sure you document it in API_CHANGES and the CHANGELOG
Thanks,
JDH
From: Eric F. <ef...@ha...> - 2006年07月31日 17:51:42
Thanks to all who contributed to this thread concerning how to draw 
something such as text at an offset relative to a data point, with the 
offset in screen coordinates so that it stays constant with zooming etc.
The result in svn is a new function in transforms:
def offset_copy(trans, fig=None, x=0, y=0, units='inches'):
 '''
 Return a shallow copy of a transform with an added offset.
 args:
 trans is any transform
 kwargs:
 fig is the current figure; it can be None if units are 'dots'
 x, y give the offset
 units is 'inches', 'points' or 'dots'
 '''
This works for all transformations including polar; an example is given 
in examples/transoffset.py, also in svn.
All transformations now have shallowcopy and deepcopy methods; the 
shallowcopy method is used in offset_copy. The deepcopy methods were 
there all along in _transforms.cpp, with functionality apparently partly 
duplicated in the copy_bbox_transform function in transforms.py. John 
added copy_bbox_transform_shallow to transforms.py as part of this 
thread. I would like to remove it, together with copy_bbox_transform, 
on the grounds that these functions probably have not been used by 
anyone except during the last few days, and their functionality is 
available in a much more general way via the Transformation deepcopy and 
shallowcopy methods.
Any objections?
Thanks.
Eric
From: Chris S <chr...@gm...> - 2006年07月31日 15:52:29
I'm trying to plot dates using plot_date(), but the date for every
point is labeled on the axis, and in a verbose format, resulting in a
jumble of text making the date-axis completely unreadable. Is there
any way to control the format of the dates displayed, and ensure only
a small percentage of points are labeled on the axis?
Chris
From: Charlie M. <cw...@gm...> - 2006年07月31日 14:21:02
On 7/31/06, Jo=E3o Quinta da Fonseca <joa...@gm...> wrote:
> I'm trying to quit Matlab and use python fro my data analysis. I have
> installed the latest MacPython (universal), wxpython, aggdraw and
> matplotlib from pythonmac.org. Everything seems to work, apart from
> matplotlib. Running from ipython:
>
> In [1]: from pylab import *
> In [2]: plot([1,2,3,4])
>
> I get:
>
> Out[2]: [<matplotlib.lines.Line2D instance at 0x4ddfb70>]
>
> but nothing appears, not even an error message. I get a bouncing
> anvil (MacPython logo) on the dock but nothing happens.
> If I run python in verbose mode I get:
>
> plot([1,2,3])
> import MacOS # dynamically loaded from /Library/Frameworks/
> Python.framework/Versions/2.4/lib/python2.4/lib-dynload/MacOS.so
> [<matplotlib.lines.Line2D instance at 0x4c9eaa8>]
>
> unfortunately this means nothing to me. Can anyone help? Thanks,
For non-interactive pylab, just type "show()" after your code above.
The -pylab option John mentioned is the ideal way to go though.
- Charlie
From: John H. <jdh...@ac...> - 2006年07月31日 14:10:04
>>>>> "Jo=E3o" =3D=3D Jo=E3o Quinta da Fonseca <joa...@gm...>=
 writes:
 Jo=E3o> I'm trying to quit Matlab and use python fro my data
 Jo=E3o> analysis. I have installed the latest MacPython (universal),
 Jo=E3o> wxpython, aggdraw and matplotlib from
 Jo=E3o> pythonmac.org. Everything seems to work, apart from
 Jo=E3o> matplotlib. Running from ipython:
 Jo=E3o> In [1]: from pylab import * In [2]: plot([1,2,3,4])
Did you launch ipython in pylab mode?
 > ipython -pylab
If so you don't need to import pylab and your figures your should work
as expected.
See http://matplotlib.sf.net/interactive.html for details.
JDH
From: <joa...@gm...> - 2006年07月31日 14:08:03
I'm trying to quit Matlab and use python fro my data analysis. I have 
installed the latest MacPython (universal), wxpython, aggdraw and 
matplotlib from pythonmac.org. Everything seems to work, apart from 
matplotlib. Running from ipython:
In [1]: from pylab import *
In [2]: plot([1,2,3,4])
I get:
Out[2]: [<matplotlib.lines.Line2D instance at 0x4ddfb70>]
but nothing appears, not even an error message. I get a bouncing 
anvil (MacPython logo) on the dock but nothing happens.
If I run python in verbose mode I get:
plot([1,2,3])
import MacOS # dynamically loaded from /Library/Frameworks/ 
Python.framework/Versions/2.4/lib/python2.4/lib-dynload/MacOS.so
[<matplotlib.lines.Line2D instance at 0x4c9eaa8>]
unfortunately this means nothing to me. Can anyone help? Thanks,
Joao
From: <joa...@ma...> - 2006年07月31日 14:01:29
I'm trying to quit Matlab and use python fro my data analysis. I have 
installed the latest MacPython (universal), wxpython, aggdraw and 
matplotlib from pythonmac.org. Everything seems to work, apart from 
matplotlib. Running from ipython:
In [1]: from pylab import *
In [2]: plot([1,2,3,4])
I get:
Out[2]: [<matplotlib.lines.Line2D instance at 0x4ddfb70>]
but nothing appears, not even an error message. I get a bouncing 
anvil (MacPython logo) on the dock but nothing happens.
If I run python in verbose mode I get:
plot([1,2,3])
import MacOS # dynamically loaded from /Library/Frameworks/ 
Python.framework/Versions/2.4/lib/python2.4/lib-dynload/MacOS.so
[<matplotlib.lines.Line2D instance at 0x4c9eaa8>]
unfortunately this means nothing to me. Can anyone help? Thanks,
Joao
From: Eric E. <ems...@ob...> - 2006年07月31日 13:51:29
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
 <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
beautiful!<br>
I was in the meantime working out something using the suggestion Eric
sent me (e.g. via pcolormesh) and I could work most of things I wanted
out, but at the price of a rather stupidly looking management of the
axis and rotation (maybe there is a way for improvement here too...). <br>
Your solution may indeed be a cleaner way forward! I'll try both ways
and see how I manage to get things done (the main problem being my
rather poor ability in writing advanced codes in python...<br>
<br>
thanks &amp;<br>
cheers!<br>
Eric<br>
<br>
John Hunter wrote:
<blockquote cite="mid...@pe..."
 type="cite">
 <blockquote type="cite">
 <blockquote type="cite">
 <blockquote type="cite">
 <blockquote type="cite">
 <blockquote type="cite">
 <pre wrap="">"Eric" == Eric Emsellem <a class="moz-txt-link-rfc2396E" href="mailto:ems...@ob...">&lt;ems...@ob...&gt;</a> writes:
 </pre>
 </blockquote>
 </blockquote>
 </blockquote>
 </blockquote>
 </blockquote>
 <pre wrap=""><!---->
 Eric&gt; Hi, this is a question I have posted earlier, but
 Eric&gt; unfortunately I didn't get any answer. if anybody has any
 Eric&gt; hint on how to do this, I would be most graceful!! Thanks
 Eric&gt; in advance!
I looked at this a bit -- the underlying image extension code handles
image rotations but it is not exposed at the python level. I spent
some time working on an image class that would handle rotations (in
this test code below I just hardcoded the rotation for testing). The
missing part is to get the extent and image placement algorithms to do
the layout properly in the presence of rotation (eg handling extent
and corners properly below). But this should give the enterprising
developer a head start if they want to run with with. Basically, I
just copied the guts out of the axes.image.AxesImage.make_image code
to experiment with adding a rotation
from matplotlib.image import AxesImage
from pylab import subplot, show, nx
...
 </pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">-- 
====================================================================
Eric Emsellem <a class="moz-txt-link-abbreviated" href="mailto:ems...@ob...">ems...@ob...</a>
 Centre de Recherche Astrophysique de Lyon
9 av. Charles-Andre tel: +33 (0)4 78 86 83 84
69561 Saint-Genis Laval Cedex fax: +33 (0)4 78 86 83 86
France <a class="moz-txt-link-freetext" href="http://www-obs.univ-lyon1.fr/eric.emsellem">http://www-obs.univ-lyon1.fr/eric.emsellem</a>
====================================================================
</pre>
</body>
</html>
From: John H. <jdh...@ac...> - 2006年07月31日 13:36:15
>>>>> "Eric" == Eric Emsellem <ems...@ob...> writes:
 Eric> Hi, this is a question I have posted earlier, but
 Eric> unfortunately I didn't get any answer. if anybody has any
 Eric> hint on how to do this, I would be most graceful!! Thanks
 Eric> in advance!
I looked at this a bit -- the underlying image extension code handles
image rotations but it is not exposed at the python level. I spent
some time working on an image class that would handle rotations (in
this test code below I just hardcoded the rotation for testing). The
missing part is to get the extent and image placement algorithms to do
the layout properly in the presence of rotation (eg handling extent
and corners properly below). But this should give the enterprising
developer a head start if they want to run with with. Basically, I
just copied the guts out of the axes.image.AxesImage.make_image code
to experiment with adding a rotation
from matplotlib.image import AxesImage
from pylab import subplot, show, nx
class RotatedImage(AxesImage):
 def make_image(self):
 from matplotlib.colors import normalize, colorConverter
 from matplotlib.numerix import arange, asarray, UInt8, Float32, repeat, NewAxis, typecode
 import matplotlib._image as _image
 if self._A is not None:
 if self._imcache is None:
 if typecode(self._A) == UInt8:
 im = _image.frombyte(self._A, 0)
 im.is_grayscale = False
 else:
 x = self.to_rgba(self._A, self._alpha)
 im = _image.fromarray(x, 0)
 if len(self._A.shape) == 2:
 im.is_grayscale = self.cmap.is_gray()
 else:
 im.is_grayscale = False
 self._imcache = im
 else:
 im = self._imcache
 else:
 raise RuntimeError('You must first set the image array or the image attribute')
 bg = colorConverter.to_rgba(self.axes.get_frame().get_facecolor(), 0)
 if self.origin=='upper':
 im.flipud_in()
 im.set_bg( *bg)
 im.set_interpolation(self._interpd[self._interpolation])
 # image input dimensions
 numrows, numcols = im.get_size()
 im.reset_matrix()
 xmin, xmax, ymin, ymax = self.get_extent()
 dxintv = xmax-xmin
 dyintv = ymax-ymin
 # the viewport scale factor
 sx = dxintv/self.axes.viewLim.width()
 sy = dyintv/self.axes.viewLim.height()
 if im.get_interpolation()!=_image.NEAREST:
 im.apply_translation(-1, -1)
 # the viewport translation
 tx = (xmin-self.axes.viewLim.xmin())/dxintv * numcols
 #if flipy:
 # ty = -(ymax-self.axes.viewLim.ymax())/dyintv * numrows
 #else:
 # ty = (ymin-self.axes.viewLim.ymin())/dyintv * numrows
 ty = (ymin-self.axes.viewLim.ymin())/dyintv * numrows
 l, b, widthDisplay, heightDisplay = self.axes.bbox.get_bounds()
 im.apply_translation(tx, ty)
 im.apply_scaling(sx, sy)
 # resize viewport to display
 rx = widthDisplay / numcols
 ry = heightDisplay / numrows
 im.apply_scaling(rx, ry)
 im.apply_rotation(45.)
 #print tx, ty, sx, sy, rx, ry, widthDisplay, heightDisplay
 im.resize(int(widthDisplay+0.5), int(heightDisplay+0.5),
 norm=self._filternorm, radius=self._filterrad)
 if self.origin=='upper':
 im.flipud_in()
 return im
ax = subplot(111)
im = RotatedImage(ax, interpolation='nearest')
im.set_data(nx.mlab.rand(10,10))
xmin, xmax, ymin, ymax = im.get_extent()
corners = (xmin, ymin), (xmax, ymax)
ax.update_datalim(corners)
ax.set_xlim((xmin, xmax))
ax.set_ylim((ymin, ymax))
ax.images.append(im)
show()
From: Eric F. <ef...@ha...> - 2006年07月31日 01:16:46
I think you can get the effect you describe using pcolor or pcolormesh; 
the latter is faster but due to a bug it doesn't handle alpha values 
other than 1. You will have to generate arrays with the pixel corners 
(not centers) as you want them to be after your rotation. You will want 
to use the shading='flat' kwarg.
Eric
Eric Emsellem wrote:
> Hi,
> 
> this is a question I have posted earlier, but unfortunately I didn't get
> any answer.
> if anybody has any hint on how to do this, I would be most graceful!!
> Thanks in advance!
> 
> I would like to visualize an image after a rotation:
> ==> this means to view each squared pixels as "rotated" (seen as an
> rotated square). I have in fact several images which I need to plot on
> the same figure (with subplot), each of these having different "rotation
> angles".
> 
> The rough solution would be to rotate the data itself (x and y) and use
> imshow after some rebinning on a squared grid. But this would not be
> showing the original data, which is what I wish to do.
> Is it possible to do this in mpl?
> 
> thanks!
> 
> Eric
> 
> -------------------------------------------------------------------------
> 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: Richard R. <ric...@pa...> - 2006年07月30日 23:49:45
Thank you for the 'fix'. Both the demo and my old matplotlib based scripts work again.
Richard
On Friday 28 July 2006 17:19, Richard Ruth wrote:
> I upgraded to matplotlib-0.87.4 Now I receive an error like the following
> every time I try to use matplotlib.dates. The following error messages
> were generated when I tried to run matplotlib-0.87.4/examples/date_demo1.py
>
> Any Idea on how I can get dates working again?
> (I am running the 2.6.17.6 kernel on a 64-bit linux system)
Richard,
in matplotlib/dates.py, change line 155 from
remainder = x - ix
to
remainder = float(x) - ix
The problem is that matplotlib uses numpy arrays for the xaxis. As you have a 
64b system, the arrays are in float64scalars, that divmod doesn't know how to 
process (unless you have a very recent of numpy). The trick above forces a 
downcasting of float64scalar to float32scalar, divmod can now work.
From: Webb S. <web...@gm...> - 2006年07月30日 23:28:16
I am doing a buch of plots and I would like to set the dash on/off
list globally (to [2,4]) rather than everytime I run pylab.plot(). Is
there any such thing?
Thanks!
From: Eric E. <ems...@ob...> - 2006年07月30日 20:38:00
Hi,
this is a question I have posted earlier, but unfortunately I didn't get
any answer.
if anybody has any hint on how to do this, I would be most graceful!!
Thanks in advance!
I would like to visualize an image after a rotation:
==> this means to view each squared pixels as "rotated" (seen as an
rotated square). I have in fact several images which I need to plot on
the same figure (with subplot), each of these having different "rotation
angles".
The rough solution would be to rotate the data itself (x and y) and use
imshow after some rebinning on a squared grid. But this would not be
showing the original data, which is what I wish to do.
Is it possible to do this in mpl?
thanks!
Eric
From: Eric F. <ef...@ha...> - 2006年07月30日 00:31:40
Stefan van der Walt wrote:
> On Thu, Jul 27, 2006 at 08:57:47PM -0400, PGM wrote:
> 
>>>Is this normal? If so, how do I get around the problem? I also
>>>noticed that, even without extents, the image gets scaled after
>>>plotting.
>>
>>Try to set the "_autoscale" parameter of your current 'axes' to False. That 
>>way, you should avoid any inopportune rescaling. For the image, try to use 
>>aspect='auto'.
>>
>>For example,
>>
>>P.imshow(x,extent=(0,x.shape[1],x.shape[0],0))
>>P.gca().set_autoscale_on(False)
> 
> 
> Thanks, P., that did the trick! It looks like the right way to fix
> the scaling of the axes extents, but I am still not sure whether the
> axis flipping behaviour I described earlier is correct.
I changed it in svn 2636; now Axes.autoscale_view() preserves axis 
direction. I think this will be generally useful and will cause less 
user surprise than the previous behavior.
Eric
From: Eric F. <ef...@ha...> - 2006年07月29日 23:47:03
Nick,
svn 2635 has a fix for this bug.
Eric
Nick Fotopoulos wrote:
> Dear matplotlib-users,
> 
> I'd like to report a bug in Polygon, which is crashing with an 
> unhelpful error message where an exception would be appropriate. The 
> problem occurs when you feed Polygon an Nx2 array instead of an N- 
> length list of 2-tuples. This is on my PPC OSX system, with 
> everything freshly checked out from SVN (should the matplotlib 
> version still be 0.87.4?).
> 
> Versions:
> In [152]: numpy.__version__
> Out[152]: '1.1.2881'
> In [154]: matplotlib.__version__
> Out[154]: '0.87.4'
> 
> 
> Code:
> import pylab, numpy
> 
> theta = numpy.pi/4*numpy.arange(9,dtype=float)
> 
> x = numpy.cos(theta)
> y = numpy.sin(theta)
> 
> # The following line works
> #p = pylab.Polygon(zip(x,y))
> 
> # The following line causes a crash
> p = pylab.Polygon(numpy.vstack((x,y)).T)
> 
> ax = pylab.subplot(111)
> ax.add_patch(p)
> pylab.show()
From: Eric F. <ef...@ha...> - 2006年07月29日 22:19:00
Nick,
Thanks for the bug report. I have been making some changes to use 
numerix more consistently internally, and fixing this bug would be a 
step in that direction. I will take a look.
Eric
Nick Fotopoulos wrote:
> Dear matplotlib-users,
> 
> I'd like to report a bug in Polygon, which is crashing with an 
> unhelpful error message where an exception would be appropriate. The 
> problem occurs when you feed Polygon an Nx2 array instead of an N- 
> length list of 2-tuples. This is on my PPC OSX system, with 
> everything freshly checked out from SVN (should the matplotlib 
> version still be 0.87.4?).
> 
> Versions:
> In [152]: numpy.__version__
> Out[152]: '1.1.2881'
> In [154]: matplotlib.__version__
> Out[154]: '0.87.4'
> 
> 
> Code:
> import pylab, numpy
> 
> theta = numpy.pi/4*numpy.arange(9,dtype=float)
> 
> x = numpy.cos(theta)
> y = numpy.sin(theta)
> 
> # The following line works
> #p = pylab.Polygon(zip(x,y))
> 
> # The following line causes a crash
> p = pylab.Polygon(numpy.vstack((x,y)).T)
> 
> ax = pylab.subplot(111)
> ax.add_patch(p)
> pylab.show()
> 
> 
> Output:
> In [155]: run plot_polygon.py
> ------------------------------------------------------------------------ 
> ---
> exceptions.TypeError Traceback (most 
> recent call last)
> 
> /Users/nvf/Documents/S.M. Thesis/plot_polygon.py
> 10
> 11 ax = pylab.subplot(111)
> ---> 12 ax.add_patch(p)
> 13 pylab.show() 14
> 
> /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
> packages/matplotlib/axes.py in add_patch(self, p)
> 899 p.get_transform(), p.get_verts())
> 900 #for x,y in xys: print x,y
> --> 901 self.update_datalim(xys)
> 902 self.patches.append(p)
> 903
> 
> /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site- 
> packages/matplotlib/axes.py in update_datalim(self, xys)
> 913 # Otherwise, it will compute the bounds of it's 
> current data
> 914 # and the data in xydata
> --> 915 self.dataLim.update(xys, -1)
> 916
> 917
> 
> TypeError: CXX : Error creating object of type N2Py5TupleE
> WARNING: Failure executing file: <plot_polygon.py>
> 
> 
> Instead of converting from crash to exception, though, would it be 
> possible to make it accept an Nx2 array?
> 
> Please at least cc me in any replies, as I am not subscribed to this 
> list.
> 
> Thanks,
> Nick
> 
> -------------------------------------------------------------------------
> 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: John H. <jdh...@ac...> - 2006年07月29日 18:11:46
>>>>> "PGM" == PGM <pgm...@gm...> writes:
 PGM> Richard, in matplotlib/dates.py, change line 155 from
 PGM> remainder = x - ix to remainder = float(x) - ix
Thanks for th tip -- I'll commit this to svn.
JDH
From: PGM <pgm...@gm...> - 2006年07月29日 17:28:03
On Friday 28 July 2006 17:19, Richard Ruth wrote:
> I upgraded to matplotlib-0.87.4 Now I receive an error like the following
> every time I try to use matplotlib.dates. The following error messages
> were generated when I tried to run matplotlib-0.87.4/examples/date_demo1.py
>
> Any Idea on how I can get dates working again?
> (I am running the 2.6.17.6 kernel on a 64-bit linux system)
Richard,
in matplotlib/dates.py, change line 155 from
remainder = x - ix
to
remainder = float(x) - ix
The problem is that matplotlib uses numpy arrays for the xaxis. As you have a 
64b system, the arrays are in float64scalars, that divmod doesn't know how to 
process (unless you have a very recent of numpy). The trick above forces a 
downcasting of float64scalar to float32scalar, divmod can now work.
From: Jouni K S. <jk...@ik...> - 2006年07月29日 05:47:18
Till Wagner <sac...@ya...> writes:
> The program should be localized to german, frensh, italian and
> spanish, so the names can include some umlauts and special
> characters (like ä, ü, ö, ß, ß, é and so on). In my program it works
> well, but in the matplotlib-graphs are only squares where the
> umlauts should be. Same with the legend. Any help or tips?
The font encoding doesn't match the encoding you're using. Using
unicode strings, e.g. u"\u00e4" for ä, may work better, assuming of
course that the font does have the characters you need and that the
backend implements unicode text.
Some resources about Unicode in Python are
 http://www.jorendorff.com/articles/unicode/python.html
 http://dalchemy.com/opensource/unicodedoc/
-- 
Jouni
From: Charlie M. <cw...@gm...> - 2006年07月29日 05:04:44
It can't find tk.h so it looks like you need to install the tk dev packages.
On 7/28/06, se...@ma... <se...@ma...> wrote:
> Here is the output of an attempt to install 0.87.4 with tkagg.
>
> It installs fine without it.
>
>
> Any ideas will be appreciated.
>
> TIA,
> -sen
>
> compile options:
> '-I/usr/lib/python2.4/site-packages/numpy/core/include
> -I/usr/local/include -I/usr/include -I. -I/usr/local/include
> -I/usr/include -I. -I/
> usr/include/pygtk-2.0 -I/usr/include/glib-2.0
> -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0
> -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/inc
> lude/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2
> -I/usr/include/freetype2/config -I/usr/include/glib-2.0
> -I/usr/lib/glib-2.0/include -I/usr/i
> nclude/python2.4 -c'
> extra options: '-DSCIPY=1'
> gcc: src/_ns_backend_gdk.c
> gcc -pthread -shared build/temp.linux-i686-2.4/src/_ns_backend_gdk.o
> -L/usr/local/lib -L/usr/lib -L/usr/local/lib -L/usr/lib -lgobject-2.0
> -lglib-2.0 -lgtk
> -x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0
> -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
> -o build/lib.linu
> x-i686-2.4/matplotlib/backends/_ns_backend_gdk.so
> building 'matplotlib.backends._tkagg' extension
> C compiler: gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe
> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4
> -fasynchronous-un
> wind-tables -D_GNU_SOURCE -fPIC -fPIC
>
> compile options: '-I/usr/include -I/usr/include -I/usr/local/include
> -I/usr/include -I. -Isrc -Iswig -Iagg23/include
> -I. -I/usr/local/include -I/usr/includ
> e -I. -I/usr/include/freetype2 -I/usr/include/freetype2
> -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2
> -Isrc/freetype2 -Iswig/freety
> pe2 -Iagg23/include/freetype2 -I./freetype2
> -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2
> -I/usr/include/python2.4 -c'
> gcc: src/_tkagg.cpp
> src/_tkagg.cpp:28:18: error: tk.h: No such file or directory
> src/_tkagg.cpp:36: error: ISO C++ forbids declaration of 'Tcl_Interp'
> with no type
> src/_tkagg.cpp:36: error: expected ';' before '*' token
> src/_tkagg.cpp:40: error: 'ClientData' was not declared in this scope
> src/_tkagg.cpp:40: error: 'Tcl_Interp' was not declared in this scope
> src/_tkagg.cpp:40: error: 'interp' was not declared in this scope
> src/_tkagg.cpp:41: error: expected primary-expression before 'int'
> src/_tkagg.cpp:41: error: expected primary-expression before 'char'
> src/_tkagg.cpp:41: error: initializer expression list treated as
> compound expression
> src/_tkagg.cpp:42: error: expected ',' or ';' before '{' token
> src/_tkagg.cpp: In function 'PyObject* _tkinit(PyObject*, PyObject*)':
> src/_tkagg.cpp:174: error: 'Tcl_Interp' was not declared in this scope
> src/_tkagg.cpp:174: error: 'interp' was not declared in this scope
> src/_tkagg.cpp:183: error: expected primary-expression before ')'
> token
> src/_tkagg.cpp:183: error: expected `;' before 'arg'
> src/_tkagg.cpp:188: error: 'struct TkappObject' has no member named
> 'interp'
> src/_tkagg.cpp:194: error: 'Tcl_CmdProc' was not declared in this
> scope
> src/_tkagg.cpp:194: error: expected primary-expression before ')'
> token
> src/_tkagg.cpp:195: error: 'ClientData' was not declared in this scope
> src/_tkagg.cpp:195: error: 'Tcl_CmdDeleteProc' was not declared in
> this scope
> src/_tkagg.cpp:195: error: expected primary-expression before ')'
> token
> src/_tkagg.cpp:195: error: 'Tcl_CreateCommand' was not declared in
> this scope
> src/_tkagg.cpp:28:18: error: tk.h: No such file or directory
> src/_tkagg.cpp:36: error: ISO C++ forbids declaration of 'Tcl_Interp'
> with no type
> src/_tkagg.cpp:36: error: expected ';' before '*' token
> src/_tkagg.cpp:40: error: 'ClientData' was not declared in this scope
> src/_tkagg.cpp:40: error: 'Tcl_Interp' was not declared in this scope
> src/_tkagg.cpp:40: error: 'interp' was not declared in this scope
> src/_tkagg.cpp:41: error: expected primary-expression before 'int'
> src/_tkagg.cpp:41: error: expected primary-expression before 'char'
> src/_tkagg.cpp:41: error: initializer expression list treated as
> compound expression
> src/_tkagg.cpp:42: error: expected ',' or ';' before '{' token
> src/_tkagg.cpp: In function 'PyObject* _tkinit(PyObject*, PyObject*)':
> src/_tkagg.cpp:174: error: 'Tcl_Interp' was not declared in this scope
> src/_tkagg.cpp:174: error: 'interp' was not declared in this scope
> src/_tkagg.cpp:183: error: expected primary-expression before ')'
> token
> src/_tkagg.cpp:183: error: expected `;' before 'arg'
> src/_tkagg.cpp:194: error: 'Tcl_CmdProc' was not declared in this
> scope
> src/_tkagg.cpp:194: error: expected primary-expression before ')'
> token
> src/_tkagg.cpp:195: error: 'ClientData' was not declared in this scope
> src/_tkagg.cpp:195: error: 'Tcl_CmdDeleteProc' was not declared in
> this scope
> src/_tkagg.cpp:195: error: expected primary-expression before ')'
> token
> src/_tkagg.cpp:195: error: 'Tcl_CreateCommand' was not declared in
> this scope
> error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g
> -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386
> -mtune=pentium4 -fasynchronou
> s-unwind-tables -D_GNU_SOURCE -fPIC -fPIC -I/usr/include
> -I/usr/include -I/usr/local/include -I/usr/include -I. -Isrc -Iswig
> -Iagg23/include -I. -I/usr/loc
> al/include -I/usr/include -I. -I/usr/include/freetype2
> -I/usr/include/freetype2 -I/usr/local/include/freetype2
> -I/usr/include/freetype2 -I./freetype2 -Isrc
> /freetype2 -Iswig/freetype2 -Iagg23/include/freetype2 -I./freetype2
> -I/usr/local/include/freetype2 -I/usr/include/freetype2 -I./freetype2
> -I/usr/include/py
> thon2.4 -c src/_tkagg.cpp -o build/temp.linux-i686-2.4/src/_tkagg.o"
> failed with exit status 1
>
>
>
3 messages has been excluded from this view by a project administrator.

Showing results of 313

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