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 30

1 2 > >> (Page 1 of 2)
From: <se...@ma...> - 2006年07月28日 22:57:20
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=3D1'
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=3D2 -fexceptions -m32 -march=3Di386 -mtune=3Dpentiu=
m4
-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 =E2=80=98Tcl_Int=
erp=E2=80=99
with no type
src/_tkagg.cpp:36: error: expected =E2=80=98;=E2=80=99 before =E2=80=98*=E2=
=80=99 token
src/_tkagg.cpp:40: error: =E2=80=98ClientData=E2=80=99 was not declared i=
n this scope
src/_tkagg.cpp:40: error: =E2=80=98Tcl_Interp=E2=80=99 was not declared i=
n this scope
src/_tkagg.cpp:40: error: =E2=80=98interp=E2=80=99 was not declared in th=
is scope
src/_tkagg.cpp:41: error: expected primary-expression before =E2=80=98int=
=E2=80=99
src/_tkagg.cpp:41: error: expected primary-expression before =E2=80=98cha=
r=E2=80=99
src/_tkagg.cpp:41: error: initializer expression list treated as
compound expression
src/_tkagg.cpp:42: error: expected =E2=80=98,=E2=80=99 or =E2=80=98;=E2=80=
=99 before =E2=80=98{=E2=80=99 token
src/_tkagg.cpp: In function =E2=80=98PyObject* _tkinit(PyObject*, PyObjec=
t*)=E2=80=99:
src/_tkagg.cpp:174: error: =E2=80=98Tcl_Interp=E2=80=99 was not declared =
in this scope
src/_tkagg.cpp:174: error: =E2=80=98interp=E2=80=99 was not declared in t=
his scope
src/_tkagg.cpp:183: error: expected primary-expression before =E2=80=98)=E2=
=80=99
token
src/_tkagg.cpp:183: error: expected `;' before =E2=80=98arg=E2=80=99
src/_tkagg.cpp:188: error: =E2=80=98struct TkappObject=E2=80=99 has no me=
mber named
=E2=80=98interp=E2=80=99
src/_tkagg.cpp:194: error: =E2=80=98Tcl_CmdProc=E2=80=99 was not declared=
 in this
scope
src/_tkagg.cpp:194: error: expected primary-expression before =E2=80=98)=E2=
=80=99
token
src/_tkagg.cpp:195: error: =E2=80=98ClientData=E2=80=99 was not declared =
in this scope
src/_tkagg.cpp:195: error: =E2=80=98Tcl_CmdDeleteProc=E2=80=99 was not de=
clared in
this scope
src/_tkagg.cpp:195: error: expected primary-expression before =E2=80=98)=E2=
=80=99
token
src/_tkagg.cpp:195: error: =E2=80=98Tcl_CreateCommand=E2=80=99 was not de=
clared 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 =E2=80=98Tcl_Int=
erp=E2=80=99
with no type
src/_tkagg.cpp:36: error: expected =E2=80=98;=E2=80=99 before =E2=80=98*=E2=
=80=99 token
src/_tkagg.cpp:40: error: =E2=80=98ClientData=E2=80=99 was not declared i=
n this scope
src/_tkagg.cpp:40: error: =E2=80=98Tcl_Interp=E2=80=99 was not declared i=
n this scope
src/_tkagg.cpp:40: error: =E2=80=98interp=E2=80=99 was not declared in th=
is scope
src/_tkagg.cpp:41: error: expected primary-expression before =E2=80=98int=
=E2=80=99
src/_tkagg.cpp:41: error: expected primary-expression before =E2=80=98cha=
r=E2=80=99
src/_tkagg.cpp:41: error: initializer expression list treated as
compound expression
src/_tkagg.cpp:42: error: expected =E2=80=98,=E2=80=99 or =E2=80=98;=E2=80=
=99 before =E2=80=98{=E2=80=99 token
src/_tkagg.cpp: In function =E2=80=98PyObject* _tkinit(PyObject*, PyObjec=
t*)=E2=80=99:
src/_tkagg.cpp:174: error: =E2=80=98Tcl_Interp=E2=80=99 was not declared =
in this scope
src/_tkagg.cpp:174: error: =E2=80=98interp=E2=80=99 was not declared in t=
his scope
src/_tkagg.cpp:183: error: expected primary-expression before =E2=80=98)=E2=
=80=99
token
src/_tkagg.cpp:183: error: expected `;' before =E2=80=98arg=E2=80=99
src/_tkagg.cpp:194: error: =E2=80=98Tcl_CmdProc=E2=80=99 was not declared=
 in this
scope
src/_tkagg.cpp:194: error: expected primary-expression before =E2=80=98)=E2=
=80=99
token
src/_tkagg.cpp:195: error: =E2=80=98ClientData=E2=80=99 was not declared =
in this scope
src/_tkagg.cpp:195: error: =E2=80=98Tcl_CmdDeleteProc=E2=80=99 was not de=
clared in
this scope
src/_tkagg.cpp:195: error: expected primary-expression before =E2=80=98)=E2=
=80=99
token
src/_tkagg.cpp:195: error: =E2=80=98Tcl_CreateCommand=E2=80=99 was not de=
clared in
this scope
error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g
-pipe -Wp,-D_FORTIFY_SOURCE=3D2 -fexceptions -m32 -march=3Di386
-mtune=3Dpentium4 -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
From: Charlie M. <cw...@gm...> - 2006年07月28日 22:55:26
On 7/28/06, se...@ma... <se...@ma...> wrote:
> OK, I was able to install with 0.87.4 (still no tkagg, however).
What's the error you are getting with tk? Do you have the dev
packages installed?
> This is still with the tar.gz version of numpy-1.0b
>
> I will try to re-install numpy from the rpms to see if that makes a
> difference.
> -sen
>
> BTW You guys are great! I love the way you got to my questions so
> fast. Reminds me of the old redhat days (e.g. when Eric Troan, Donnie
> Barnes, Marc Ewing, etc. would answer questions on the mailing lists).
Thanks!
From: <se...@ma...> - 2006年07月28日 22:51:20
I got the numpy src.rpm from www.numpy.org
On 2006年7月28日, Asheesh Laroia wrote:
> On 2006年7月27日, se...@ma... wrote:
>
>> All of the necessary addons- scipy, numarray, Numeric, gtk, etc have been 
>> added.
>
> Well, something in the build system thinks something is missing. So let us 
> know *exactly* what RPMs you installed (with URLs preferably), or where you 
> got the source packages for those things and how you installed them.
>
> -- Asheesh.
>
>
-- 
 ---------------------------------------------------------------------------
 | Sheldon E. Newhouse | e-mail: se...@ma... |
 | Mathematics Department | 				 |
 | Michigan State University | telephone: 517-355-9684 |
 | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 |
 ---------------------------------------------------------------------------
From: <se...@ma...> - 2006年07月28日 22:50:25
OK, I was able to install with 0.87.4 (still no tkagg, however).
This is still with the tar.gz version of numpy-1.0b
I will try to re-install numpy from the rpms to see if that makes a
difference. 
-sen
BTW You guys are great! I love the way you got to my questions so
fast. Reminds me of the old redhat days (e.g. when Eric Troan, Donnie
Barnes, Marc Ewing, etc. would answer questions on the mailing lists).
I hope you can keep it up.
On 2006年7月28日, Charlie Moad wrote:
> It looks like Travis committed a numpy 1.0 compatibility fix on July
> 7th. It includes the header which addresses your error. You will
> have to use >=matplotlib-0.87.4 if you want to use the latest numpy.
>
> - Charlie
>
From: Bill B. <wb...@gm...> - 2006年07月28日 22:14:41
Hey that's great. Thanks Jouni. There may be a better way, but this
is at least a lot easier to figure out than the code in QuiverKey!
You can even throw all the magic into one function like this:
def const_offset(x,y):
 ax = gca()
 ll1 = ax.transData.get_bbox1().ll()
 ur1 = ax.transData.get_bbox1().ur()
 ll2 = ax.transData.get_bbox2().ll()
 ur2 = ax.transData.get_bbox2().ur()
 scale_x = (ur2.x()-ll2.x())/(ur1.x()-ll1.x())
 scale_y = (ur2.y()-ll2.y())/(ur1.y()-ll1.y())
 offset = Point(Value(x), Value(y))
 trans = Affine(scale_x, zero(), zero(), scale_y,
 ll2.x()-scale_x*ll1.x() + offset.x(),
 ll2.y()-scale_y*ll1.y() + offset.y())
 return trans
And then just add a transform=const_offset(x,y) parameter wherever
you want one.
Great. And it works for things besides text too.
--------------------
#!/usr/bin/env python
import matplotlib
from matplotlib.transforms import Value, zero, Affine, Point
from pylab import figure, show, gca
def const_offset(x,y):
 ax = gca()
 ll1 = ax.transData.get_bbox1().ll()
 ur1 = ax.transData.get_bbox1().ur()
 ll2 = ax.transData.get_bbox2().ll()
 ur2 = ax.transData.get_bbox2().ur()
 scale_x = (ur2.x()-ll2.x())/(ur1.x()-ll1.x())
 scale_y = (ur2.y()-ll2.y())/(ur1.y()-ll1.y())
 offset = Point(Value(x), Value(y))
 trans = Affine(scale_x, zero(), zero(), scale_y,
 ll2.x()-scale_x*ll1.x() + offset.x(),
 ll2.y()-scale_y*ll1.y() + offset.y())
 return trans
x = (3,1,4,1,5,9,2,6,5,3,5,8,9,7,9,3)
y = (2,7,1,8,2,8,1,8,2,8,4,5,9,0,4,5)
fig=figure()
ax=fig.add_subplot(111)
ax.plot(x,y,'.')
for a,b in zip(x,y):
 ax.text(a, b, '(%d,%d)'%(a,b), transform=const_offset(20,0))
ax.plot(x,y, 'gv',transform=const_offset(0,-10))
ax.plot(x,y, 'm^',transform=const_offset(0, 10))
show()
From: Jeff W. <js...@fa...> - 2006年07月28日 22:01:45
Jeff Sadino wrote:
> Hello All,
>
> I am trying to map the surface of TItan for a summer internship project at 
> NASA. I would like to use matplotlib to plot, but I need to plot in West 
> Longitude, where the left edge of the graph starts at 360 and the right edge 
> ends at 0. Does anyone know how to do this?
>
> Thanks much,
> Jeff
>
>
> 
Jeff: Using the basemap toolkit,
from matplotlib.toolkits.basemap import Basemap
# setup cylindrical equidistant map projection (global domain).
# resolution=None means don't bother with earth coastlines and political 
boundaries.
m = 
Basemap(llcrnrlon=0.,llcrnrlat=-90,urcrnrlon=360.,urcrnrlat=90.,resolution=None,projection='cyl')
# use plot, contour, imshow, pcolor .. methods to plot the data here
# draw parallels
delat = 30.
circles = arange(0.,90.+delat,delat).tolist()+\
 arange(-delat,-90.-delat,-delat).tolist()
m.drawparallels(circles,labels=[1,0,0,1])
# draw meridians
delon = 60.
meridians = arange(-180,180,delon)
m.drawmeridians(meridians,labels=[1,0,0,1])
title('Cylindrical Equidistant')
show()
There are lots of examples in the source distribution, and a short 
tutorial is here
http://www.scipy.org/Cookbook/Matplotlib/Maps
HTH,
-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-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Richard R. <ric...@pa...> - 2006年07月28日 21:19:24
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)
Example:
matplotlib-0.87.4/examples]$ python date_demo1.py
Traceback (most recent call last):
 File "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_gtk.py", line 284, in expose_event
 self._render_figure(self._pixmap, w, h)
 File "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_gtkagg.py", line 73, in _render_figure
 FigureCanvasAgg.draw(self)
 File "/usr/lib64/python2.4/site-packages/matplotlib/backends/backend_agg.py", line 391, in draw
 self.figure.draw(renderer)
 File "/usr/lib64/python2.4/site-packages/matplotlib/figure.py", line 532, in draw
 for a in self.axes: a.draw(renderer)
 File "/usr/lib64/python2.4/site-packages/matplotlib/axes.py", line 1045, in draw
 a.draw(renderer)
 File "/usr/lib64/python2.4/site-packages/matplotlib/axis.py", line 548, in draw
 majorLabels = [self.major.formatter(val, i) for i, val in enumerate(majorLocs)]
 File "/usr/lib64/python2.4/site-packages/matplotlib/dates.py", line 247, in __call__
 dt = num2date(x, self.tz)
 File "/usr/lib64/python2.4/site-packages/matplotlib/dates.py", line 205, in num2date
 if not iterable(x): return _from_ordinalf(x, tz)
 File "/usr/lib64/python2.4/site-packages/matplotlib/dates.py", line 156, in _from_ordinalf
 hour, remainder = divmod(24*remainder, 1)
ValueError: need more than 0 values to unpack
Traceback (most recent call last):
Richard
From: Eric F. <ef...@ha...> - 2006年07月28日 20:35:17
John,
Very good--I will work on it this weekend.
Eric
> Eric, how about adding a helper method to matplotlib.transforms call
> "relative_to", something like
> 
> trans = relative_to(artist, pointsx, pointsy)
> 
> you can get dpi from artist.figure.dpi to construct the right
> points->pixels offset. Then you could do
> 
> trans = relative_to(line, -5, 10)
> ax.text(x, y, 'hi', transform=trans)
> 
> This may not be the perfect API, but it should give you the idea of
> providing a very simple interface to users to build these transforms
> for offsets.
> 
> JDH
From: Darren D. <dd...@co...> - 2006年07月28日 20:13:02
On Monday 24 July 2006 15:12, Jouni K Seppanen wrote:
> Tommy Grav <tg...@ma...> writes:
> > The window resizes horisontally when the pointer is inside the
> > window, although the window behaves erratically as it resizes.
> > Moving the pointer to the right will cause the window to grow then
> > reduce size as you go further right.
>
> Is this related to the pointer coordinates shown in the lower-right
> corner of the window? I.e., when you move the pointer right, perhaps
> the x-coordinate becomes a longer number and the window is enlarged to
> accommodate it. I remember seeing behavior like this on some old
> version of Matplotlib (probably TkAgg backend on OS X) but cannot
> reproduce it now.
I fixed this problem for the qt backends. The coordinates of the cursor are 
rendered in a label, and the resize policy of the label needs to be set so it 
doesnt try to grow to accomodate the long string.
Darren
Hi all,
 I would like to enable the key pressed event (key '1' '2' 'a' 'g' .. )
of NavigationToolbar2 in my pyGTK app.
(These keys shortcut are described here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1432252&group_id=80706&atid=560722
)
The shorcuts work perfectly using pylab. But when I include matplotlib in my
pyGTK app the shorcuts are broken.
How could I manage to make them work,
and/or,
where I should start in the source code to undestand how it work, that I
could reproduce the shorkey behavior directly in my own application code?.
Thanks,
David
From: Till W. <sac...@ya...> - 2006年07月28日 19:21:31
Hi,
i have a problem with matplotlib (i use version 0.85
with python 2.3). In some graphs it is necessary to
have the name of the registered user in the title. I
do this like this:
self.axes = self.figure.add_subplot(111)
[...]
axesTitle = "Registered to %s." %user 
self.axes.set_title(axesTitle , fontsize = 8)
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?
Thanks
 Till Wagner
	
	
		
___________________________________________________________ 
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de
From: Charlie M. <cw...@gm...> - 2006年07月28日 19:20:45
What version of numpy are you using, and was it installed from source
or package?
On 7/27/06, se...@ma... <se...@ma...> wrote:
> Hello,
> I am trying to install matplotlib-0.87.3 on a Fedora Core 4 box
>
> The system has python-2.4 installed
>
> All of the necessary addons- scipy, numarray, Numeric, gtk, etc have
> been added.
>
> I am including the output of running
>
> $ python setup.py install
>
> Any help is appreciated.
>
> -Thanks,
> -sen1
>
> Output of above script:
>
> /usr/lib/python2.4/site-packages/numpy/lib/utils.py:92:
> DeprecationWarning: get_
> numpy_include is deprecated, use get_include
> DeprecationWarning)
> running install
> running build
> running build_py
> running build_ext
> building 'matplotlib._ns_cntr' extension
> C compiler: gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe
> -Wp,-D_FORTI
> FY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4
> -fasynchronous-unwind-
> tables -D_GNU_SOURCE -fPIC -fPIC
>
> compile options:
> '-I/usr/lib/python2.4/site-packages/numpy/core/include -I/usr/l
> ocal/include -I/usr/include -I. -I/usr/include/python2.4 -c'
> extra options: '-DSCIPY=1'
> gcc: src/_ns_cntr.c
> src/_ns_cntr.c: In function 'Cntr_init':
> src/_ns_cntr.c:1582: error: 'PyArray_SBYTE' undeclared (first use in
> this functi
> on)
> src/_ns_cntr.c:1582: error: (Each undeclared identifier is reported
> only once
> src/_ns_cntr.c:1582: error: for each function it appears in.)
> src/_ns_cntr.c: In function 'Cntr_init':
> src/_ns_cntr.c:1582: error: 'PyArray_SBYTE' undeclared (first use in
> this functi
> on)
> src/_ns_cntr.c:1582: error: (Each undeclared identifier is reported
> only once
> src/_ns_cntr.c:1582: error: for each function it appears in.)
> error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g
> -pipe -Wp,-D_F
> ORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4
> -fasynchronous-unw
> ind-tables -D_GNU_SOURCE -fPIC -fPIC
> -I/usr/lib/python2.4/site-packages/numpy/co
> re/include -I/usr/local/include -I/usr/include
> -I. -I/usr/include/python2.4 -c s
> rc/_ns_cntr.c -o build/temp.linux-i686-2.4/src/_ns_cntr.o -DSCIPY=1"
> failed with
> exit status 1
>
>
> -------------------------------------------------------------------------
> 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月28日 19:19:22
>>>>> "Eric" == Eric Firing <ef...@ha...> writes:
 Eric> Attached is a simple example that illustrates the method.
 Eric> What threw me off last night is that the
 Eric> copy_bbox_transform() function was not doing what I
 Eric> expected. I don't know yet whether this is because of a bug
 Eric> or a misunderstanding on my part, but in any case, the
 Eric> example provides an alternative. (It is not valid for any
 Eric> bbox transform, but I think it will be fine in normal use
What I just wrote to Eric offlist is that copy_bbox_transform is a
deep copy, and so all the references of the matplotlib transforms are
lost (see http://matplotlib.sf.net/matplotlib.transforms.html for
details on the reference semantics of mpl transforms). What we want
is a shallow copy -- this is like Eric's get_bbox_transform below but
also handles nonlinear transformation like log
I added to svn:
def copy_bbox_transform_shallow(trans):
 """
 return a shallow copy of the bbox transform -- the Values are
 retained by reference but the transform is copied. This allows
 you to copy a transform, set a new offset to it, but not lose the
 value reference semantics
 """
 inbox = trans.get_bbox1()
 outbox = trans.get_bbox2()
 typex = trans.get_funcx().get_type()
 typey = trans.get_funcy().get_type()
 newtrans = get_bbox_transform(inbox, outbox)
 newtrans.get_funcx().set_type(typex)
 newtrans.get_funcy().set_type(typey)
 return newtrans
 Eric> cases.) The basic method can be used on any artist by
 Eric> calling set_offset on that artist's transform. 
More precisely, on a shallow copy of any artist's transform. You
don't want to set the offset of the artist's transform itself, since
that will move the artist itself.
Eric, how about adding a helper method to matplotlib.transforms call
"relative_to", something like
 trans = relative_to(artist, pointsx, pointsy)
you can get dpi from artist.figure.dpi to construct the right
points->pixels offset. Then you could do
 trans = relative_to(line, -5, 10)
 ax.text(x, y, 'hi', transform=trans)
This may not be the perfect API, but it should give you the idea of
providing a very simple interface to users to build these transforms
for offsets.
JDH
From: Eric F. <ef...@ha...> - 2006年07月28日 19:09:22
Attachments: transoffset.py
Attached is a simple example that illustrates the method. What threw me 
off last night is that the copy_bbox_transform() function was not doing 
what I expected. I don't know yet whether this is because of a bug or a 
misunderstanding on my part, but in any case, the example provides an 
alternative. (It is not valid for any bbox transform, but I think it 
will be fine in normal use cases.) The basic method can be used on any 
artist by calling set_offset on that artist's transform. Once again, 
John's transform module works its magic!
I will make a more complete example and include it in the examples 
subdirectory of mpl. This is really great functionality that needs to 
be made more readily accessible.
Eric
John Hunter wrote:
>>>>>>"Eric" == Eric Firing <ef...@ha...> writes:
> 
> 
> Eric> I think that what you want to do requires something like the
> Eric> mechanism in QuiverKey: a derived artist with a draw method
> Eric> that figures out at draw time where to put the text; I don't
> Eric> think there is any other way to handle zooming while keeping
> Eric> the screen separation from a data point fixed.
> 
> You can do this using offsets -- see
> matplotlib.axis.XTick._get_text1. This is how tick labeling is done
> (a point offset from an x location in data coords and a y location in
> axis coords). Here is an example -- you have to copy the default data
> transform so that the offset doesn't affect the figure data
> 
> from matplotlib.transforms import Value, translation_transform,blend_xy_sep_transform
> from pylab import figure, show
> 
> fig = figure()
> ax = fig.add_subplot(111)
> points = 7
> pad = fig.dpi*Value(points/72.0)
> # poor man's copy
> trans = blend_xy_sep_transform(ax.transData, ax.transData)
> 
> # to the left and above
> offset = translation_transform(Value(-1)*pad, pad)
> trans.set_offset( (0,0), offset)
> 
> ax.plot([1,2,3])
> 
> t = ax.text(1,2, 'hi', transform=trans)
> 
> show()
> 
> 
> 
From: Asheesh L. <as...@as...> - 2006年07月28日 18:46:09
On 2006年7月27日, se...@ma... wrote:
> All of the necessary addons- scipy, numarray, Numeric, gtk, etc have 
> been added.
Well, something in the build system thinks something is missing. So let 
us know *exactly* what RPMs you installed (with URLs preferably), or where 
you got the source packages for those things and how you installed them.
-- Asheesh.
-- 
You have been selected for a secret mission.
From: Charlie M. <cw...@gm...> - 2006年07月28日 18:41:14
It looks like Travis committed a numpy 1.0 compatibility fix on July
7th. It includes the header which addresses your error. You will
have to use >=matplotlib-0.87.4 if you want to use the latest numpy.
- Charlie
On 7/28/06, se...@ma... <se...@ma...> wrote:
> OK,
> I removed the rpms, and used a direct install of numpy-1.0b1 from the
> tar.gz package.
>
> Then, I tried to install matplotlib-0.87 from the tar.gz package.
>
> Apparently, same problem:
>
> python setup.py build >& build.log
> [root@gumbie matplotlib-0.87.3]# tail build.log
> gcc: src/_ns_cntr.c
> src/_ns_cntr.c: In function 'Cntr_init':
> src/_ns_cntr.c:1582: error: 'PyArray_SBYTE' undeclared (first use in
> this function)
> src/_ns_cntr.c:1582: error: (Each undeclared identifier is reported
> only once
> src/_ns_cntr.c:1582: error: for each function it appears in.)
> src/_ns_cntr.c: In function 'Cntr_init':
> src/_ns_cntr.c:1582: error: 'PyArray_SBYTE' undeclared (first use in
> this function)
> src/_ns_cntr.c:1582: error: (Each undeclared identifier is reported
> only once
> src/_ns_cntr.c:1582: error: for each function it appears in.)
> error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g
> -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386
> -mtune=pentium4 -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fPIC
> -I/usr/lib/python2.4/site-packages/numpy/core/include
> -I/usr/local/include -I/usr/include -I. -I/usr/include/python2.4 -c
> src/_ns_cntr.c -o build/temp.linux-i686-2.4/src/_ns_cntr.o -DSCIPY=1"
> failed with exit status 1
>
>
> On 2006年7月28日, Charlie Moad wrote:
>
> > What version of numpy are you using, and was it installed from source
> > or package?
> >
> > On 7/27/06, se...@ma... <se...@ma...> wrote:
> >> Hello,
> >> I am trying to install matplotlib-0.87.3 on a Fedora Core 4 box
> >>
> >> The system has python-2.4 installed
> >>
> >> All of the necessary addons- scipy, numarray, Numeric, gtk, etc have
> >> been added.
> >>
> >> I am including the output of running
> >>
> >> $ python setup.py install
> >>
> >> Any help is appreciated.
> >>
> >> -Thanks,
> >> -sen1
> >>
> >> Output of above script:
> >>
> >> /usr/lib/python2.4/site-packages/numpy/lib/utils.py:92:
> >> DeprecationWarning: get_
> >> numpy_include is deprecated, use get_include
> >> DeprecationWarning)
> >> running install
> >> running build
> >> running build_py
> >> running build_ext
> >> building 'matplotlib._ns_cntr' extension
> >> C compiler: gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe
> >> -Wp,-D_FORTI
> >> FY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4
> >> -fasynchronous-unwind-
> >> tables -D_GNU_SOURCE -fPIC -fPIC
> >>
> >> compile options:
> >> '-I/usr/lib/python2.4/site-packages/numpy/core/include -I/usr/l
> >> ocal/include -I/usr/include -I. -I/usr/include/python2.4 -c'
> >> extra options: '-DSCIPY=1'
> >> gcc: src/_ns_cntr.c
> >> src/_ns_cntr.c: In function 'Cntr_init':
> >> src/_ns_cntr.c:1582: error: 'PyArray_SBYTE' undeclared (first use in
> >> this functi
> >> on)
> >> src/_ns_cntr.c:1582: error: (Each undeclared identifier is reported
> >> only once
> >> src/_ns_cntr.c:1582: error: for each function it appears in.)
> >> src/_ns_cntr.c: In function 'Cntr_init':
> >> src/_ns_cntr.c:1582: error: 'PyArray_SBYTE' undeclared (first use in
> >> this functi
> >> on)
> >> src/_ns_cntr.c:1582: error: (Each undeclared identifier is reported
> >> only once
> >> src/_ns_cntr.c:1582: error: for each function it appears in.)
> >> error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g
> >> -pipe -Wp,-D_F
> >> ORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4
> >> -fasynchronous-unw
> >> ind-tables -D_GNU_SOURCE -fPIC -fPIC
> >> -I/usr/lib/python2.4/site-packages/numpy/co
> >> re/include -I/usr/local/include -I/usr/include
> >> -I. -I/usr/include/python2.4 -c s
> >> rc/_ns_cntr.c -o build/temp.linux-i686-2.4/src/_ns_cntr.o -DSCIPY=1"
> >> failed with
> >> exit status 1
> >>
> >>
> >> -------------------------------------------------------------------------
> >> 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
> >>
> >>
> >>
> >
>
> --
> ---------------------------------------------------------------------------
> | Sheldon E. Newhouse | e-mail: se...@ma... |
> | Mathematics Department | |
> | Michigan State University | telephone: 517-355-9684 |
> | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 |
> ---------------------------------------------------------------------------
>
From: Charlie M. <cw...@gm...> - 2006年07月28日 18:31:51
> Is it easy to unstall one version of a module before installing
> another one.
It will just overwrite the old files, so normally you don't run into
problems. There is no defacto way to remove the modules though. It
is usually pretty obvious what needs to be removed from the
site-packages folder. Sometimes it is a little more difficult.
Matplotlib installs matplotlib, pytz, dateutil, and pylab.py.
- Charlie
From: <se...@ma...> - 2006年07月28日 18:30:00
OK,
I removed the rpms, and used a direct install of numpy-1.0b1 from the
 tar.gz package.
Then, I tried to install matplotlib-0.87 from the tar.gz package.
Apparently, same problem:
python setup.py build >& build.log
[root@gumbie matplotlib-0.87.3]# tail build.log
gcc: src/_ns_cntr.c
src/_ns_cntr.c: In function =E2=80=98Cntr_init=E2=80=99:
src/_ns_cntr.c:1582: error: =E2=80=98PyArray_SBYTE=E2=80=99 undeclared (f=
irst use in
this function)
src/_ns_cntr.c:1582: error: (Each undeclared identifier is reported
only once
src/_ns_cntr.c:1582: error: for each function it appears in.)
src/_ns_cntr.c: In function =E2=80=98Cntr_init=E2=80=99:
src/_ns_cntr.c:1582: error: =E2=80=98PyArray_SBYTE=E2=80=99 undeclared (f=
irst use in
this function)
src/_ns_cntr.c:1582: error: (Each undeclared identifier is reported
only once
src/_ns_cntr.c:1582: error: for each function it appears in.)
error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g
-pipe -Wp,-D_FORTIFY_SOURCE=3D2 -fexceptions -m32 -march=3Di386
-mtune=3Dpentium4 -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fPIC
-I/usr/lib/python2.4/site-packages/numpy/core/include
-I/usr/local/include -I/usr/include -I. -I/usr/include/python2.4 -c
src/_ns_cntr.c -o build/temp.linux-i686-2.4/src/_ns_cntr.o -DSCIPY=3D1"
failed with exit status 1
On 2006年7月28日, Charlie Moad wrote:
> What version of numpy are you using, and was it installed from source
> or package?
>
> On 7/27/06, se...@ma... <se...@ma...> wrote:
>> Hello,
>> I am trying to install matplotlib-0.87.3 on a Fedora Core 4 box
>>=20
>> The system has python-2.4 installed
>>=20
>> All of the necessary addons- scipy, numarray, Numeric, gtk, etc have
>> been added.
>>=20
>> I am including the output of running
>>=20
>> $ python setup.py install
>>=20
>> Any help is appreciated.
>>=20
>> -Thanks,
>> -sen1
>>=20
>> Output of above script:
>>=20
>> /usr/lib/python2.4/site-packages/numpy/lib/utils.py:92:
>> DeprecationWarning: get_
>> numpy_include is deprecated, use get_include
>> DeprecationWarning)
>> running install
>> running build
>> running build_py
>> running build_ext
>> building 'matplotlib._ns_cntr' extension
>> C compiler: gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe
>> -Wp,-D_FORTI
>> FY_SOURCE=3D2 -fexceptions -m32 -march=3Di386 -mtune=3Dpentium4
>> -fasynchronous-unwind-
>> tables -D_GNU_SOURCE -fPIC -fPIC
>>=20
>> compile options:
>> '-I/usr/lib/python2.4/site-packages/numpy/core/include -I/usr/l
>> ocal/include -I/usr/include -I. -I/usr/include/python2.4 -c'
>> extra options: '-DSCIPY=3D1'
>> gcc: src/_ns_cntr.c
>> src/_ns_cntr.c: In function 'Cntr_init':
>> src/_ns_cntr.c:1582: error: 'PyArray_SBYTE' undeclared (first use in
>> this functi
>> on)
>> src/_ns_cntr.c:1582: error: (Each undeclared identifier is reported
>> only once
>> src/_ns_cntr.c:1582: error: for each function it appears in.)
>> src/_ns_cntr.c: In function 'Cntr_init':
>> src/_ns_cntr.c:1582: error: 'PyArray_SBYTE' undeclared (first use in
>> this functi
>> on)
>> src/_ns_cntr.c:1582: error: (Each undeclared identifier is reported
>> only once
>> src/_ns_cntr.c:1582: error: for each function it appears in.)
>> error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g
>> -pipe -Wp,-D_F
>> ORTIFY_SOURCE=3D2 -fexceptions -m32 -march=3Di386 -mtune=3Dpentium4
>> -fasynchronous-unw
>> ind-tables -D_GNU_SOURCE -fPIC -fPIC
>> -I/usr/lib/python2.4/site-packages/numpy/co
>> re/include -I/usr/local/include -I/usr/include
>> -I. -I/usr/include/python2.4 -c s
>> rc/_ns_cntr.c -o build/temp.linux-i686-2.4/src/_ns_cntr.o -DSCIPY=3D1"
>> failed with
>> exit status 1
>>=20
>>=20
>> ----------------------------------------------------------------------=
---
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to shar=
e=20
>> your
>> opinions on IT & business topics through brief surveys -- and earn cas=
h
>> http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=
=3DDEVDEV
>>=20
>> _______________________________________________
>> Matplotlib-users mailing list
>> Mat...@li...
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>=20
>>=20
>>=20
>
--=20
 -----------------------------------------------------------------------=
----
 | Sheldon E. Newhouse | e-mail: se...@ma... =
 |
 | Mathematics Department | 				 |
 | Michigan State University | telephone: 517-355-9684 =
 |
 | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 =
 |
 -----------------------------------------------------------------------=
----
From: <se...@ma...> - 2006年07月28日 18:25:11
I installed numpy-1.0b1 from a src RPM. I built the RPM from the src
RPM.
Given your question, I will try to reinstall using the tar.gz file.
Incidentally, I went back to matplotlib-0.83, and was able to install
that after disabling the TKAGG module.
I'll report back on the tar.gz thing.
Incidentally, it seems to me looking at the various modules available,
that it is wise to use the tar.gz files instead of rpms.
Is it easy to unstall one version of a module before installing
another one.
E.g. something like
 python setup.py remove
I'm sorry, but I am very new to python and its resources.
In the gnu world, of course, one usually has "make uninstall"
Thanks for any information.
-sen1
On 2006年7月28日, Charlie Moad wrote:
> What version of numpy are you using, and was it installed from source
> or package?
>
> On 7/27/06, se...@ma... <se...@ma...> wrote:
>> Hello,
>> I am trying to install matplotlib-0.87.3 on a Fedora Core 4 box
>> 
>> The system has python-2.4 installed
>> 
>> All of the necessary addons- scipy, numarray, Numeric, gtk, etc have
>> been added.
>> 
>> I am including the output of running
>> 
>> $ python setup.py install
>> 
>> Any help is appreciated.
>> 
>> -Thanks,
>> -sen1
>> 
>> Output of above script:
>> 
>> /usr/lib/python2.4/site-packages/numpy/lib/utils.py:92:
>> DeprecationWarning: get_
>> numpy_include is deprecated, use get_include
>> DeprecationWarning)
>> running install
>> running build
>> running build_py
>> running build_ext
>> building 'matplotlib._ns_cntr' extension
>> C compiler: gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe
>> -Wp,-D_FORTI
>> FY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4
>> -fasynchronous-unwind-
>> tables -D_GNU_SOURCE -fPIC -fPIC
>> 
>> compile options:
>> '-I/usr/lib/python2.4/site-packages/numpy/core/include -I/usr/l
>> ocal/include -I/usr/include -I. -I/usr/include/python2.4 -c'
>> extra options: '-DSCIPY=1'
>> gcc: src/_ns_cntr.c
>> src/_ns_cntr.c: In function 'Cntr_init':
>> src/_ns_cntr.c:1582: error: 'PyArray_SBYTE' undeclared (first use in
>> this functi
>> on)
>> src/_ns_cntr.c:1582: error: (Each undeclared identifier is reported
>> only once
>> src/_ns_cntr.c:1582: error: for each function it appears in.)
>> src/_ns_cntr.c: In function 'Cntr_init':
>> src/_ns_cntr.c:1582: error: 'PyArray_SBYTE' undeclared (first use in
>> this functi
>> on)
>> src/_ns_cntr.c:1582: error: (Each undeclared identifier is reported
>> only once
>> src/_ns_cntr.c:1582: error: for each function it appears in.)
>> error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g
>> -pipe -Wp,-D_F
>> ORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4
>> -fasynchronous-unw
>> ind-tables -D_GNU_SOURCE -fPIC -fPIC
>> -I/usr/lib/python2.4/site-packages/numpy/co
>> re/include -I/usr/local/include -I/usr/include
>> -I. -I/usr/include/python2.4 -c s
>> rc/_ns_cntr.c -o build/temp.linux-i686-2.4/src/_ns_cntr.o -DSCIPY=1"
>> failed with
>> exit status 1
>> 
>> 
>> -------------------------------------------------------------------------
>> 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
>> 
>> 
>> 
>
-- 
 ---------------------------------------------------------------------------
 | Sheldon E. Newhouse | e-mail: se...@ma... |
 | Mathematics Department | 				 |
 | Michigan State University | telephone: 517-355-9684 |
 | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562 |
 ---------------------------------------------------------------------------
From: PGM <pgm...@gm...> - 2006年07月28日 18:03:34
Glen,
Funny, I ran into exactly the same problem earlier that week. My guess is that 
you use numpy, right ? 0.9.8 ? On a 64b machine ?
If that's the case, you should have the same problem with divmod and numpy 
each time you use float64 as dtype: each element is a float64scalar that 
divmod doesn't know how to process. Downcasting to float32 does the trick 
(either by forcing it as dtype, or using a python float().
According to the numpy list, the problem has been corrected in the SVN 
version. As I didn't want to install the SVN version yet, I found this 
workaround with matplotlib:
in matplotlib/dates.py, change line 155 from
remainder = x - ix
to
remainder = float(x) - ix
That's enough to force the conversion float64scalar to float.
From: John H. <jdh...@ac...> - 2006年07月28日 17:47:18
>>>>> "Eric" == Eric Firing <ef...@ha...> writes:
 Eric> I think that what you want to do requires something like the
 Eric> mechanism in QuiverKey: a derived artist with a draw method
 Eric> that figures out at draw time where to put the text; I don't
 Eric> think there is any other way to handle zooming while keeping
 Eric> the screen separation from a data point fixed.
You can do this using offsets -- see
matplotlib.axis.XTick._get_text1. This is how tick labeling is done
(a point offset from an x location in data coords and a y location in
axis coords). Here is an example -- you have to copy the default data
transform so that the offset doesn't affect the figure data
from matplotlib.transforms import Value, translation_transform,blend_xy_sep_transform
from pylab import figure, show
fig = figure()
ax = fig.add_subplot(111)
points = 7
pad = fig.dpi*Value(points/72.0)
# poor man's copy
trans = blend_xy_sep_transform(ax.transData, ax.transData)
# to the left and above
offset = translation_transform(Value(-1)*pad, pad)
trans.set_offset( (0,0), offset)
ax.plot([1,2,3])
t = ax.text(1,2, 'hi', transform=trans)
show()
From: Stefan v. d. W. <st...@su...> - 2006年07月28日 14:44:59
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.
>=20
> Try to set the "_autoscale" parameter of your current 'axes' to False. =
That=20
> way, you should avoid any inopportune rescaling. For the image, try to =
use=20
> aspect=3D'auto'.
>=20
> For example,
>=20
> P.imshow(x,extent=3D(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.
Regards
St=E9fan
From: Stefan v. d. W. <st...@su...> - 2006年07月28日 07:13:52
Hi Eric
On Thu, Jul 27, 2006 at 02:57:31PM -1000, Eric Firing wrote:
> That certainly looks to me like a bug, but it is not obvious to me afte=
r=20
> a quick look where the bug is (although I suspect it is very simple),=20
> and I can't look at it more right now. If someone else doesn't chime i=
n=20
> with a fix, you might want to file a bug report on sourceforge to make=20
> sure it is not forgotten. Maybe I can take another look within the next=
=20
> few days.
>=20
> What do you mean when you say "the image gets scaled after
> plotting"?
Thanks very much for having looked at this. My sentence above should
probably have read "the limits of the x-axis change after plotting".
They say two pictures are worth two-thousand words:
http://mentat.za.net/refer/before_plot.png
http://mentat.za.net/refer/after_plot.png
Regards
St=E9fan
From: Eric F. <ef...@ha...> - 2006年07月28日 05:09:41
Michael,
I'm probably not the right person to be answering, but in the absence=
 of=20
other responses I will try.
Michael Schwager wrote:
> Hi, I=92m trying to do some CAD type things with Matplotlib. I=
=92m using=20
> python 2.4 with both PS and GTK backends in WinXP. Specifically, I=
=92m=20
> trying to find distances between objects (lines, polygons, circles)=
, so=20
> I=92d like to extract all the elements/lines/polygons/arcs/circles =
in an=20
> axis, but I don=92t see how to do that.=20
When you say "distances", do you mean distances in physical coordinat=
es=20
as rendered? Is that why you can't simply use the data you are plott=
ing=20
directly? If so, maybe the thing to do is use the same transforms th=
at=20
are used in rendering, but apply them to your input data yourself, an=
d=20
then do the calculations on your transformed data. Every Artist=20
includes the transforms that are used in transforming the input data =
to=20
physical coordinates. These physical coordinates do not get saved, b=
ut=20
they can be reconstructed.
> Also, I need to draw arcs, but it seems I can only do that by direc=
tly=20
> manipulating the renderer. I=92m trying to get everything done usi=
ng only=20
> the pylab interface. I tried creating a RendererPS directly, but i=
t=20
> took some funny arguments (eg a StreamIO) which I wasn=92t sure wha=
t to do=20
> with.
The matplotlib drawing model is very basic; the way to make an arc=
=20
without writing your own backend is to calculate an adequate number o=
f=20
points and then plot them as a line. For example, you could subclass=
=20
Axes and add an "arc" method that does this.
Longer term, it probably makes sense to expand the matplotlib drawing=
=20
model to include more primitives such as arcs, using the native=20
functionality to render them when possible. This could make quite a =
few=20
things more efficient.
Eric
From: Eric F. <ef...@ha...> - 2006年07月28日 03:00:42
Bill Baxter wrote:
> Great. Thanks. I'll take a look at that file. Is "transFigure" the
> one that I was calling "screen space"?
All of the transforms go from some particular coordinate system to what 
one might call "screen coordinates": position in dots (pixels), with 
(0,0) in the lower left corner. transFigure and transAxes go from 
normalized coordinates to these screen coordinates; for transFigure, 
(0,0) and (1,1) are the lower left and upper right corners of the 
figure, and for transAxes they are the corners of the axes.
I think that what you want to do requires something like the mechanism 
in QuiverKey: a derived artist with a draw method that figures out at 
draw time where to put the text; I don't think there is any other way to 
handle zooming while keeping the screen separation from a data point fixed.
This may be a common enough task to warrant adding an "offset" tuple 
kwarg to the Text class, and maybe a transOffset as well.
Eric
> 
> --bb
> 
> On 7/28/06, Eric Firing <ef...@ha...> wrote:
> 
>> Bill,
>>
>> You can see an example of how to do something similar by looking at the
>> QuiverKey class in quiver.py. It is all a matter of using the
>> transforms module.
>>
>> Eric
>>
>> Bill Baxter wrote:
>> > I want to draw some labels with plot.text() and have them appear a
>> > given number of pixels (or mm, or points) to above and to the right of
>> > the data points they are describing. Is there some way to specify a
>> > screen offset from a point in graph coordinates? Like a method of the
>> > axes that converts from screen to graph coords? Using graph
>> > coordinates means that when I zoom in really close to see some
>> > details, the text labels are way out in never-never land.
>> >
>> > Thanks,
>> > --bb
>>

Showing results of 30

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