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
(3) |
2
(9) |
3
(4) |
|
4
(1) |
5
|
6
(5) |
7
(8) |
8
(11) |
9
(15) |
10
(5) |
|
11
(2) |
12
|
13
(7) |
14
(4) |
15
(13) |
16
(6) |
17
(1) |
|
18
|
19
(16) |
20
(10) |
21
(13) |
22
(13) |
23
(3) |
24
(1) |
|
25
(3) |
26
(4) |
27
(1) |
28
(6) |
29
(6) |
30
(1) |
31
|
|
From: Rodrigo C. <rc...@ge...> - 2004-07-09 00:30:28
|
I did some python CGI scripting at one point, and I needed to do something like os.environ['MATPLOTLIBDATA'] = '/where/matplotlib/lives' before the matplotlib import ... hope that helps, rodrigo --- Rodrigo Caballero Augi (http://geosci.uchicago.edu/~rca) Research Associate Department of the Geophysical Sciences, University of Chicago 5734 South Ellis Avenue, Chicago, IL 60637, USA. On Thursday, July 8, 2004, at 06:26 PM, Jonathan Hanson wrote: > I'm having issues importing matplotlib into my python script, but only > when runing under PHP. > > The line: > from matplotlib import * > > causes my .py script to return an error code "1" when being called > from inside a PHP script. However, the script runs just fine when > called from the command line. > > If i comment out the above line and all the matplotlib-related > commands in my script, it will run just fine (but without plots of > course). But the include command alone is enough to cause an error 1 > return. > > I have been through every documentation source I can find, I've tried > every variation of import i can think of, and I've come up with a big > fat 0. I've tried something like: > sys.path.append("/usr/lib/python2.3/site-packages/matplotlib") > after the sys import and before the matplotlib import thinking there > was a path issue with the apache user, and got jack squat out of that. > > Has anyone else had issues calling python scripts from inside PHP? > All my other imports below: > # Module Imports > from optparse import OptionParser > import sys > #from matplotlib import * > from os import listdir > from string import split > from array import array > from time import time#, ctime > > work just fine. I've been on this for 3 solid days, someone either > shoot me or help me! Thanks. > > > ------------------------------------------------------- > This SF.Net email sponsored by Black Hat Briefings & Training. > Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital > self defense, top technical experts, no vendor pitches, unmatched > networking opportunities. Visit www.blackhat.com > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Peter G. <pgr...@ge...> - 2004-07-09 00:05:30
|
My guess would be that it is a permission issue from running udner
apache.. did you look at your apache error log files? What os are you
using? Can you run this script under apache directly (as cgi say)
instead of calling it throught php? I remember that I had to manually
change some permissions on some of the matplotlib (or maybe the font
packages that come with it) stuff to get things running...
Peter
Jonathan Hanson wrote:
> I'm having issues importing matplotlib into my python script, but only
> when runing under PHP.
>
> The line:
> from matplotlib import *
>
> causes my .py script to return an error code "1" when being called
> from inside a PHP script. However, the script runs just fine when
> called from the command line.
>
> If i comment out the above line and all the matplotlib-related
> commands in my script, it will run just fine (but without plots of
> course). But the include command alone is enough to cause an error 1
> return.
>
> I have been through every documentation source I can find, I've tried
> every variation of import i can think of, and I've come up with a big
> fat 0. I've tried something like:
> sys.path.append("/usr/lib/python2.3/site-packages/matplotlib")
> after the sys import and before the matplotlib import thinking there
> was a path issue with the apache user, and got jack squat out of that.
>
> Has anyone else had issues calling python scripts from inside PHP?
> All my other imports below:
> # Module Imports
> from optparse import OptionParser
> import sys
> #from matplotlib import *
> from os import listdir
> from string import split
> from array import array
> from time import time#, ctime
>
> work just fine. I've been on this for 3 solid days, someone either
> shoot me or help me! Thanks.
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by Black Hat Briefings & Training.
> Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital
> self defense, top technical experts, no vendor pitches, unmatched
> networking opportunities. Visit www.blackhat.com
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
|
|
From: Jonathan H. <ha...@ph...> - 2004-07-08 23:26:45
|
I'm having issues importing matplotlib into my python script, but only
when runing under PHP.
The line:
from matplotlib import *
causes my .py script to return an error code "1" when being called from
inside a PHP script. However, the script runs just fine when called
from the command line.
If i comment out the above line and all the matplotlib-related commands
in my script, it will run just fine (but without plots of course). But
the include command alone is enough to cause an error 1 return.
I have been through every documentation source I can find, I've tried
every variation of import i can think of, and I've come up with a big
fat 0. I've tried something like:
sys.path.append("/usr/lib/python2.3/site-packages/matplotlib")
after the sys import and before the matplotlib import thinking there was
a path issue with the apache user, and got jack squat out of that.
Has anyone else had issues calling python scripts from inside PHP? All
my other imports below:
# Module Imports
from optparse import OptionParser
import sys
#from matplotlib import *
from os import listdir
from string import split
from array import array
from time import time#, ctime
work just fine. I've been on this for 3 solid days, someone either
shoot me or help me! Thanks.
|
|
From: Paul B. <ba...@st...> - 2004-07-08 22:50:18
|
Flavio Codeco Coelho wrote: > Hi John, > > look at this strange bug in mathtext: > > from matplotlib.matlab import * > >>> plot([1,2,3]) > [<matplotlib.lines.Line2D instance at 0x4120f4cc>] > >>> title(r'$\alpha=6.6$') > <matplotlib.text.Text instance at 0x4120f46c> > >>> show() > > > the two sixes in the title are replaced by '&' resulting in: \alpha=&.& > > I am running 0.54.2 > > thanks > Flávio Codeço Coelho, PhD > Programa de Computação Científica > Fundação Oswaldo Cruz > Rio de Janeiro -- Brasil > > > ------------------------------------------------------------------------ > Yes. While working on Postscript support for TrueType Fonts, I came across this bug. It will be fixed in a future release. -- Paul -- Paul Barrett, PhD Space Telescope Science Institute Phone: 410-338-4475 ESS/Science Software Branch FAX: 410-338-4767 Baltimore, MD 21218 |
|
From: John H. <jdh...@ac...> - 2004-07-08 22:17:11
|
>>>>> "Rein" == Rein van den Boomgaard (UvA) <re...@sc...> writes:
Rein> What is the prefered way to read in images in
Rein> numarray/matplotlib?
No good way, currently. I plan to add a PNG loader in the near
future. Would this suffice for you? What do you think are the core
set of image formats that matplotlib should support? ... the fewer the
better!
Rein> I know of PIL but it seems like a lot of overlap with
Rein> numarray just to read an image from file.
True, but for the record, here is the recipe I use to do the PIL ->
numerix conversion
import Image
from matplotlib.matlab import *
im = Image.open('../data/leo_ratner.jpg')
s = im.tostring() # convert PIL image -> string
# convert string -> numerix array of floats
rgb = fromstring(s, UInt8).astype(Float)/255.0
# resize to RGB array
rgb = resize(rgb, (im.size[1], im.size[0], 3))
imshow(rgb, interpolation='nearest')
axis('off') # don't display the image axis
show()
|
|
From: Jeffrey J. <Jef...@gs...> - 2004-07-08 22:12:50
|
I am preparing to install matplotlib on a Mac OS X system (10.3.4). The installation page says I need to install freetype2. I already have Apple's X11 and X11sdk. I noticed that /usr/X11R6/lib contains libfreetype.a and libfreetype.dylib (the latter is a pointer to libfreetype.6.3.dylib). Is this what I need? If so, how do I tell matplotlib to use it? Also, if this is the same thing, any idea what "6.3" means in libfreetype.6.3.dylib? The tar file I got from the freetype web site is named freetype-2.1.9.tar, so it doesn't appear to make sense as a version number. Jeffrey Jones | email: jef...@gs... Code 975 - SSAI | phone: 301.614.5721 NASA/Goddard Space Flight Center | FAX: 301.614.5558 Greenbelt, MD 20771 USA | office: Bldg 33, Rm B406 |
|
From: danny s. <dan...@ya...> - 2004-07-08 22:08:03
|
Howdy, Is there an easy way to turn off the minor gridlines in a (semi)log plot? I just want the ones that are at the powers of ten. thanks, Danny __________________________________ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail |
|
From: Jared W. <wah...@um...> - 2004-07-08 21:52:24
|
Hi, Anyone is welcome to work on the SVG backend. I didn't realize that John thought I was hard at work on improving it, when actually I've been happily using it. Sorry for not communicating that... I'm not going to have any time to work on it in the near future, so go nuts. I'm an amateur, so there are plenty of bugs! :) On Thu, 2004-07-08 at 16:16, John Hunter wrote: > There is an SVG backend already in matplotlib. It hasn't been > announced because it is in development by Jared Wahlstrand. Perhaps > Jared can give a status report on what needs to be done, and you might > want to help out. He might have a more recent copy in his development > tree than I do. > > Here are the issues as I understand them: > > * image support This is waiting on a save_image function in the Agg backend, so that we can link to an external PNG file. > * font support (freetype vs afm), use of font families / > font_manager Is this the issue of 'helvetica' versus 'sans serif'? > * mathtext I don't know where to begin here, but the implementation is going to look a lot like the PS backend. It would be cool to embed MathML, but good luck finding a viewer capable of reading it... :) > * some oddness when the user calls savefig with a high dpi? > Shouldn't SVG ignore the dpi setting? That's what I did in > backend_ps. You're right, it shouldn't need to know the dpi. This is an artifact from when I ported everything from the PS backend. > * There also appears to be some problem in centering the figure? I haven't experienced this. I've been using it to export to inkscape to make figures for papers and conference talks and haven't had any major problems. The code in 0.60 is the same as I've been using, with the exception of adding another case to print_figure() to switch to the SVG backend when the filename has a .svg extension. It's not complicated code, so it should be easy to understand, but let me know if you have any questions. Cheers, Jared |
|
From: John H. <jdh...@ac...> - 2004-07-08 20:40:32
|
>>>>> "Eric" == Eric Jonas <jo...@co...> writes:
>> touch bitmap figures again. I could do entire conference
>> posters in SVG! If Justin's not interested and would accept a
>> patch, I might be willing to try and tackle this...
Eric> By which of course I mean John, or perhaps Dr. Hunter...
John works for me :-)
There is an SVG backend already in matplotlib. It hasn't been
announced because it is in development by Jared Wahlstrand. Perhaps
Jared can give a status report on what needs to be done, and you might
want to help out. He might have a more recent copy in his development
tree than I do.
Here are the issues as I understand them:
* image support
* font support (freetype vs afm), use of font families /
font_manager
* mathtext
* some oddness when the user calls savefig with a high dpi?
Shouldn't SVG ignore the dpi setting? That's what I did in
backend_ps.
* There also appears to be some problem in centering the figure?
I've only been testing this a bit - my SVG viewer doesn't seem to work
too well.
JDH
|
|
From: Eric J. <jo...@co...> - 2004-07-08 19:33:59
|
> touch bitmap figures again. I could do entire conference posters in SVG!
> If Justin's not interested and would accept a patch, I might be willing
> to try and tackle this...
By which of course I mean John, or perhaps Dr. Hunter...
...Eric
|
|
From: Eric J. <jo...@co...> - 2004-07-08 19:29:25
|
I second this question / request. The inkscape (inkscape.org) people are making a full-featured Illustrator-like replacement for vector illustration, and if matplotlib could generate SVGs, I'd never have to touch bitmap figures again. I could do entire conference posters in SVG! If Justin's not interested and would accept a patch, I might be willing to try and tackle this...=20 ...Eric On Thu, 2004-07-08 at 11:53, Flavio Codeco Coelho wrote: > Hi, >=20 > Is there a way to save vectorial figs? AGG is a vectorial renderer so > at least for this backend it should be possible... >=20 > Fl=C3=A1vio Code=C3=A7o Coelho, > PhD > Programa de Computa=C3=A7=C3=A3o > Cient=C3=ADfica > Funda=C3=A7=C3=A3o Oswaldo Cruz > Rio de Janeiro -- > Brasil >=20 >=20 > ______________________________________________________________________ |
|
From: Rein v. d. B. (UvA) <re...@sc...> - 2004-07-07 20:45:49
|
What is the prefered way to read in images in numarray/matplotlib? I know of PIL but it seems like a lot of overlap with numarray just to read an image from file. I really need to read only one type of file (say ppm) and then i can use imagemagick to convert from and to that format. Regards Rein |
|
From: John H. <jdh...@ac...> - 2004-07-07 16:17:46
|
>>>>> "Nino" == Nino Cucchiara <cuc...@me...> writes:
Nino> I want to write some greek symbols in axes legend, for
Nino> exemple nu letters or lambda. Is it possible? Thank you.
You can use mathtext anywhere you can use text. Just use the standard
way of specifying the string
s = r'$\lambda = 5$'
See http://matplotlib.sf.net/matplotlib.mathtext.html for more
information on mathtext.
You may be happy to hear that mathtext for postscript should be ready
soon!
Here is an example that uses mathtext in a legend
from matplotlib.matlab import *
t = arange(0.0, 2.0, 0.1)
plot(t, sin(2*pi*t), '--go', t, log(1+t), '.')
legend((r'$\nu$', r'$\lambda$'), 'upper right')
show()
|
|
From: Nino C. <cuc...@me...> - 2004-07-07 16:07:27
|
I want to write some greek symbols in axes legend, for exemple nu letters or lambda. Is it possible? Thank you. |
|
From: Eduardo Gonzalez-S. <eg...@as...> - 2004-07-07 16:03:02
|
Hi, I note that in the in the examples which display some images (e.g, image_origin.py) the displayed images hide one of the x-axis (top one if origin="upper" and bottom one otherwise). It seems like it may be necessary to apply an offset before displaying the images (I looked throughout the imshow.py code but didn't find the exact place to do it, it may be a problem of offsetting and scaling). Cheers, Eddie. |
|
From: John H. <jdh...@ac...> - 2004-07-07 14:35:57
|
>>>>> "Leon" == Leon Brits <lj...@fa...> writes:
Leon> Hi, I wanted to compile a old matplot program with the new
Leon> matplotlib v0.54.2 but I get the error:
Leon> NameError: name 'get_current_fig_manager' is not
Leon> defined
Leon> the line of code is:
Leon> g_canvas = get_current_fig_manager().canvas
Leon> This use to work with matplotlib v0.53. I use pyGtk v2.0.
Leon> Start code: import pygtk pygtk.require('2.0') import gtk
get_current_fig_manager is definitely defined in matplotlib.matlab in
version 0.54.2. You need to make sure you do
from matplotlib.matlab import get_current_fig_manager
before the call to
g_canvas = get_current_fig_manager().canvas
and you should have no trouble. If you are still having trouble,
you'll need to post a complete code example.
JDH
|
|
From: Leon B. <lj...@fa...> - 2004-07-07 14:27:00
|
Hi,
I wanted to compile a old matplot program with the new matplotlib v0.54.2
but I get the error:
NameError: name 'get_current_fig_manager' is not defined
the line of code is:
g_canvas = get_current_fig_manager().canvas
This use to work with matplotlib v0.53. I use pyGtk v2.0.
Start code:
import pygtk
pygtk.require('2.0')
import gtk
Please help!
Leon
|
|
From: John H. <jdh...@ac...> - 2004-07-07 12:37:18
|
>>>>> "Rein" == Rein van den Boomgaard (UvA) <re...@sc...> writes:
Rein> Dear All, as i'm new to this list let me first introduce
Rein> myself before posting a question.
Rein> I'm working in the field of image processing and computer
Rein> vision for a long time now and i am a long time matlab
Rein> user. Up to now i didn't like any of the matlab clones but
Rein> it seems that numarray+matplotlib might be a winner here.
I've worked some with octave in the past and found it unsatisfying
(though a very impressive one man feat!), in part because I wasn't
happy with gnuplot, which it used for graphics at the time (and
perhaps still does), and in part because it really aimed at being a
matlab clone but very few of my m-files ran w/o alteration.
matplotlib tries to solve the first problem by producing better
graphics than matlab and the second by not trying to be a drop in
replacement for matlab.
I'm curious about your experiences, what you tried, and what you found
lacking.
Rein> I started using numarray+matplotlib by coding the Gaussian
Rein> derivative convolutions. Calculating a derivative (by
Rein> convolving with the derivative of the Gaussian function)
Rein> will lead to an image(array) with both positive and negative
Rein> values. Although imshow should deal with that (as far as i
Rein> understand the code: beware i am a Python beginner) the
Rein> display turns black for all derivatives (except for the
Rein> 'zero order' derivative of course).
Rein> What is going on? Is it me (probably) or is it imshow?
In matplotlib-0.54.2, the images must be normalized to the unit
interval before color mapping or plotting. For example, in
examples/image_demo2.py, notice that I do
A *= 1.0/max(A)
Your images are black, I think, because you haven't normalized them.
I've done a lot of work on matplotlib images since 0.54.2, with new
fixes and features. Normalization is handled by default in the 0.60
release candidate. When I run your (very nice) example with my
development version of matplotlib, it produces this image for figure 2
( I added "show" at the end of your script, but it was otherwise
unaltered)
http://nitace.bsd.uchicago.edu:8080/files/share/fig2.png
which looks right to me. I'm always interested in nice screenshots
for the web site, so please consider donating this example!
I've uploaded the 0.60d release candidate to
http://nitace.bsd.uchicago.edu:8080/files/share/matplotlib-0.60d.tar.gz
Can you compile matplotlib yourself or are you using a binary
distribution? If you can try the development version linked above,
that would solve two problems: you'll get enhanced image support and
I'll get a tester for my image changes. If you do so, see the updated
help for the image related commands: imshow, figimage, clim, jet, gray
and the new matplotlibrc parameters image.*
In the figure 2 image from your script, I notice that there the titles
overlap the images above. Here is how you can control this (requires
matplotlib 0.60d)
# pass in these keywor args to title. The y location is the y
# text coordinate in axes coords (0,0 is lower left, 1,1 is
# upper right). You can use **somedict in place of keyword
# args in python
offsets = {'y':1.0, 'fontsize':10}
_gDplot(1,0,0)
title(r'$G$', **offsets)
_gDplot(5,1,0)
title(r'$G_x$', **offsets)
_gDplot(6,0,1)
title(r'$G_y$', **offsets)
_gDplot(9,2,0)
title(r'$G_{xx}$', **offsets)
_gDplot(10,1,1)
title(r'$G_{xy}$', **offsets)
_gDplot(11,0,2)
title(r'$G_{yy}$', **offsets)
_gDplot(13,3,0)
title(r'$G_{xxx}$', **offsets)
_gDplot(14,2,1)
title(r'$G_{xxy}$', **offsets)
_gDplot(15,1,2)
title(r'$G_{xyy}$', **offsets)
_gDplot(16,0,3)
title(r'$G_{yyy}$', **offsets)
Cheers,
JDH
|
|
From: Rein v. d. B. (UvA) <re...@sc...> - 2004-07-07 07:45:08
|
Dear All,
as i'm new to this list let me first introduce myself before posting a
question.
I'm working in the field of image processing and computer vision for a long
time now and i am a long time matlab user. Up to now i didn't like any of the
matlab clones but it seems that numarray+matplotlib might be a winner here.
I started using numarray+matplotlib by coding the Gaussian derivative
convolutions. Calculating a derivative (by convolving with the derivative of
the Gaussian function) will lead to an image(array) with both positive and
negative values. Although imshow should deal with that (as far as i
understand the code: beware i am a Python beginner) the display turns black
for all derivatives (except for the 'zero order' derivative of course).
What is going on? Is it me (probably) or is it imshow?
Attached you find the code.
Regards
Rein van den Boomgaard
University of Amsterdam
The Netherlands
# ==========================================================
# Gaussian Derivatives
#
# Copyright (c) Rein van den Boomgaard
# Vision Consultancy & Training
# re...@vi...
#
# ==========================================================
import types
from numarray import *
from numarray.nd_image import *
def gD( image, scales, orders, nscales=4, mode='reflect' ):
scales = _normalize_sequence(scales,image)
orders = _normalize_sequence(orders,image)
result = image.copy()
ndims = len( image.shape )
for i in range(0,ndims):
N = ceil(scales[i]*nscales)
x = arange( -N, N )
w = GaussianDerivativeFunction( x,
scales[i],
orders[i] )
result = convolve1d( result, w, i, mode = mode )
return( result )
def HermiteH( n, x ):
"""
Hermite Poynomial
"""
if n==0:
return 0*x + 1
elif n==1:
return 2*x
else:
return 2*x*HermiteH( n-1, x ) - 2*(n-1)*HermiteH(n-2,x)
def GaussianDerivativeFunction( x, scale, order ):
scale = float(scale)
g = 1.0 / ( scale * sqrt(2*pi) ) * exp( - x**2 / (2*scale**2) )
return (-1.0 / (scale*sqrt(2.0)))**order * \
HermiteH( order, x / (scale * sqrt(2)) ) * g
# the _normalize_sequence function is copied from numarray
# because i cant import it...???
def _normalize_sequence(input, array):
"""If input is a scalar, create a sequence of length equal to the
rank of array by duplicating the input. If input is a sequence,
check if its length is equalt to the lenght of array.
"""
if isinstance(array, ArrayType):
rank = len(array.shape)
else:
rank = 1
if (isinstance(input, (types.IntType, types.LongType, types.FloatType))):
normalized = [input] * rank
else:
if isinstance(input, numarray.numarraycore.NumArray):
normalized = list(input)
else:
normalized = input
if len(normalized) != rank:
error = "sequence argument must have length equal to input rank"
raise RuntimeError, error
return normalized
if __name__ == "__main__":
from matplotlib import use, interactive
from matplotlib.matlab import *
PLOT_1D_GAUSS = 1
PLOT_GAUSSIAN_DERIVATIVES = 1
PLOT_TIMING = 1
if PLOT_1D_GAUSS:
# testing the Gaussiand Derivatives
x=arange(-5,5,.01)
figure(1)
clf()
plot(x,GaussianDerivativeFunction(x,1,0))
plot(x,GaussianDerivativeFunction(x,1,1))
plot(x,GaussianDerivativeFunction(x,1,2))
plot(x,GaussianDerivativeFunction(x,1,3))
plot(x,GaussianDerivativeFunction(x,1,4))
xlabel(r'$x$')
ylabel(r'$G_n(x)$')
title('Gaussian Derivatives')
if PLOT_GAUSSIAN_DERIVATIVES:
scale = 9
def _gDplot(n,ox,oy):
subplot(4,4,n)
axis('off')
imshow( gD(a,scale,(ox,oy)) )
a = zeros( (64,64) ) * 1.0
a[32,32] = 1.0
figure(2)
axis('off')
title('Gaussian Derivatives')
_gDplot(1,0,0)
title(r'$G$')
_gDplot(5,1,0)
title(r'$G_x$')
_gDplot(6,0,1)
title(r'$G_y$')
_gDplot(9,2,0)
title(r'$G_{xx}$')
_gDplot(10,1,1)
title(r'$G_{xy}$')
_gDplot(11,0,2)
title(r'$G_{yy}$')
_gDplot(13,3,0)
title(r'$G_{xxx}$')
_gDplot(14,2,1)
title(r'$G_{xxy}$')
_gDplot(15,1,2)
title(r'$G_{xyy}$')
_gDplot(16,0,3)
title(r'$G_{yyy}$')
if PLOT_TIMING:
from timeit import Timer
niter = 5
def time_gD(scale):
t = Timer( "b=gD(a,%d, 0)" % scale, "from __main__ import gD,a" )
timing = t.timeit(number=niter )
print( timing/niter )
return( timing/niter )
a = zeros( (256,256) ) * 1.0
a[128,128] = 1.0
figure(3)
scales = array([1,3,5,7,9,11,15,19, 25,31,41,51])
print(type(scales))
plot( scales, map( time_gD, scales ), 'x' )
xlabel('Scale (px)')
ylabel('Time (s)')
title('Gaussian Convolution Timings')
|
|
From: John H. <jdh...@ac...> - 2004-07-06 20:28:50
|
>>>>> "danny" == danny shevitz <dan...@ya...> writes:
danny> I tried to implement a simple .matplotlibrc file. The
danny> contents are: #figure.figsize:12,9 lines.linewidth:1.0
danny> I get the following traceback:
You are trying to load backend gtk and don't have it installed. You
should not implement your own rc file, but rather edit the one in
C:\Python23\share\matplotlib\.matplotlibrc
(or wherever python is installed). This is discussed in the rc file
header, also found at http://matplotlib.sourceforge.net/.matplotlibrc.
Once you have edited it, move it to another directory, your HOME dir.
On win32, you will need to set the HOME environment variable to point
to this dir. If you edit it in place, it will work, but will be
overwritten next time you install matplotlib.
My best guess is you mangled the rc file and your backend is being set
to backend_gtk or backend_gtkagg. If indeed you want gtk or gtkagg,
my second guess is that you haven't properly installed the pygtk
prereqs.
JDH
|
|
From: John H. <jdh...@ac...> - 2004-07-06 20:16:24
|
>>>>> "danny" == danny shevitz <dan...@ya...> writes:
danny> John, First things first. Thanks for all your help. I
danny> wasn't aware of the figlegend command (even though it is
danny> clearly in the documentation). I can do what I want with
danny> figlegends althought it takes some fiddling to get the
danny> positions right. I have to use explicit coordinates because
danny> the legends are referenced to the figure not the axes so
danny> the boxes don't default to lying inside the graphs and
danny> cross over the axes boundaries. In addition the legends
danny> are in separate boxes with figlegend, which is acceptable,
danny> but not necessarily optimal. I did run into another problem
danny> using figlegend, namely that I can't get a handle to the
danny> legend text so I'm not able to set the fontsize. I'd
danny> appreciate it if you could illuminate me with how to set
danny> fontsize in a figlegend.
The way to come to this knowledge is:
1) look at the return value of the figlegend command - in this case
the docs don't say what they are, but you can always print
type(ret) or simply print(ret) where ret is the return value of
figlegend to get an idea. I've updated the docs to state
A matplotlib.legend.Legend instance is returned
2) Go to the class documentation, either by doing
help(ret) from the python shell or going to
http://matplotlib.sourceforge.net/classdocs.html and clicking on
the legend link
http://matplotlib.sourceforge.net/matplotlib.legend.html.
3) Peruse the docs for Legend: in this case you'll see
get_frame(self)
return the Rectangle instance used to frame the legend
get_lines(self)
return a list of lines.Line2D instances in the legend
get_patches(self)
return a list of patch instances in the legend
get_texts(self)
return a list of text.Text instance in the legend
So you can do
leg = figlegend(blah, blah)
texts = leg.get_texts() # get a sequence of legend texts
lines = leg.get_lines() # get a sequence of legend lines
patches = leg.get_patches() # get a sequence of legend patches
I don't mind you asking - I'm just trying to give you some pointers
for future reference.
danny> In addition the legends are in separate boxes with
danny> figlegend, which is acceptable, but not necessarily
danny> optimal.
Not sure exactly what you mean. You can put them in the same box by
controlling the list of handles and text strings you pass figlegend,
or you can turn the legend frames off....
leg.draw_frame(False)
danny> So, on to other things. I cooked up an example that shows
danny> what I was originally trying to do. I have two routines,
danny> doPlots1 and doPlots2, that do exactly the same thing. The
danny> only difference is in the default arguments, which I don't
danny> actually set, I just use the default. Figure 1 has the
danny> effect I was looking for, although I for the life of me
danny> don't understand why the two routines give difference
danny> answers, or for that matter, why figure 1 works the way it
danny> does.
danny> In any case. Figure 1 is what I was shooting for. If you
danny> want to post some reliable code that does this, I'd
danny> appreciate it.
See my comments below:
from matplotlib.matlab import *
import Numeric as N
# It is bad form to import Numeric or numarray after importing
# matplotlib. This is what numerix is for. You should use import
# matplotlib.numerix as N if you want to namespace Numeric. The
# command from matplotlib.matlab import * already imports all the
# numerix symbols.
def doPlots1(const,color,legendList=[],legendTextList=[]):
# In passing the empty list as a default argument, you are sharing the
# list between function calls. This explains why doPlots1 *works* and
# doPlots2 doesn't. This is a well know gotcha. The default
# arguments are evaluated *only once* at module load time, so
# legendList and legendText list are *the same* lists between function
# calls
y1=N.arange(0., 10, 1)+ const
x = arange(len(y1))
ln1 = plot(x,y1,color+'+-')
legendList.append(ln1)
# ln1 is a length 1 list, not a line! You should do (note the comma)
#
# ln1, = plot(x,y1,color+'+-')
#
# to unpack the length one sequence. You only get a way with it
# because legend flattens the list for you
legendTextList.append('line1')
y2 = y1 + 1
ln2 = plot(x,y2,color+'^-')
legendList.append(ln2)
legendTextList.append('line2')
legend(legendList,legendTextList)
show()
# You should only call "show" once per script. I repeat, you should
# only call "show" once per script. If you want to force a redraw use
# get_current_fig_manager().canvas.draw(). The next matplotlib
# release defines a "draw" function for this purpose.
def doPlots2(const,color):
legendList=[]
legendTextList=[]
# Here legendList and legendTextList are local to the function, not
# shared between function calls
y1=N.arange(0., 10, 1)+ const
x = arange(len(y1))
ln1 = plot(x,y1,color+'+-')
legendList.append(ln1)
legendTextList.append('line1')
y2 = y1 + 1
ln2 = plot(x,y2,color+'^-')
legendList.append(ln2)
legendTextList.append('line2')
legend(legendList,legendTextList)
show()
figure(1)
doPlots1(0,'r')
doPlots1(5,'b')
figure(2)
doPlots2(0,'r')
doPlots2(5,'b')
danny> In any case. Figure 1 is what I was shooting for. If you
danny> want to post some reliable code that does this, I'd
danny> appreciate it.
While I don't know exactly what you are shooting for, the code below
replicates what Figure 1 looks like after your second call to
doPlots1.
from matplotlib.matlab import *
handles = []
labels = []
for const, color in ( (0, 'r'), (5, 'b') ):
y1 = arange(0., 10, 1)+ const
x = arange(len(y1))
y2 = y1 + 1
lines = plot(x, y1, color+'+-', x, y2, color+'^-' )
handles.extend(lines)
labels.extend(('line1', 'line2'))
legend(handles, labels, 'upper left')
show()
Here's another approach using the label keyword arg
from matplotlib.matlab import *
handles = []
labels = []
for const, color in ( (0, 'r'), (5, 'b') ):
y1 = arange(0., 10, 1)+ const
x = arange(len(y1))
y2 = y1 + 1
plot(x, y1, color+'+-', label='line1')
plot(x, y2, color+'^-', label='line2' )
legend()
show()
Hope this helps!
JDH
|
|
From: danny s. <dan...@ya...> - 2004-07-06 20:08:43
|
I tried to implement a simple .matplotlibrc file. The contents are:
#figure.figsize:12,9
lines.linewidth:1.0
I get the following traceback:
No module named pygtk
matplotlib requires pygtk-1.99.16 or greater -- trying anyway. Please
hold on
Traceback (most recent call last):
File
"E:\projects\GeoFrag\sampleSimulations\cylinderTarget\cylinderTarget.py",
line 10, in ?
from nbe.simulation import Simulation
File "E:\projects\geoFrag\nbe\simulation\__init__.py", line 1, in ?
from simulation import Simulation
File "E:\projects\geoFrag\nbe\simulation\simulation.py", line 1, in ?
from nbe.treeFragments import cylinderFragmentationFactory
File "E:\projects\geoFrag\nbe\treeFragments\__init__.py", line 10, in
?
from cylinderFragmentation import CylinderFragmentation
File
"E:\projects\geoFrag\nbe\treeFragments\cylinderFragmentation.py", line
7,
in ?
from nbe.fragments import fragmentFactory
File "E:\projects\geoFrag\nbe\fragments\__init__.py", line 8, in ?
from fragmentLists import FragmentLists
File "E:\projects\geoFrag\nbe\fragments\fragmentLists.py", line 9, in
?
from matplotlib.matlab import *
File "D:\ENTHOU~1\Lib\site-packages\matplotlib\matlab.py", line 134,
in ?
from backends import new_figure_manager, error_msg, \
File "D:\ENTHOU~1\Lib\site-packages\matplotlib\backends\__init__.py",
line 16,
in ?
from backend_gtk import \
File
"D:\ENTHOU~1\Lib\site-packages\matplotlib\backends\backend_gtk.py",
line
13, in ?
import gobject
ImportError: No module named gobject
Any help would be appreciated.
thanks,
Danny
__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail
|
|
From: danny s. <dan...@ya...> - 2004-07-06 18:09:15
|
John,
First things first. Thanks for all your help. I wasn't aware of the
figlegend command (even though it is clearly in the documentation). I
can do what I want with figlegends althought it takes some fiddling to
get the positions right. I have to use explicit coordinates because the
legends are referenced to the figure not the axes so the boxes don't
default to lying inside the graphs and cross over the axes boundaries.
In addition the legends are in separate boxes with figlegend, which is
acceptable, but not necessarily optimal. I did run into another problem
using figlegend, namely that I can't get a handle to the legend text so
I'm not able to set the fontsize. I'd appreciate it if you could
illuminate me with how to set fontsize in a figlegend.
So, on to other things. I cooked up an example that shows what I was
originally trying to do. I have two routines, doPlots1 and doPlots2,
that do exactly the same thing. The only difference is in the default
arguments, which I don't actually set, I just use the default. Figure 1
has the effect I was looking for, although I for the life of me don't
understand why the two routines give difference answers, or for that
matter, why figure 1 works the way it does.
In any case. Figure 1 is what I was shooting for. If you want to post
some reliable code that does this, I'd appreciate it.
Danny
# %< -----------------------------------------------------
from matplotlib.matlab import *
import Numeric as N
def doPlots1(const,color,legendList=[],legendTextList=[]):
y1=N.arange(0., 10, 1)+ const
x = arange(len(y1))
ln1 = plot(x,y1,color+'+-')
legendList.append(ln1)
legendTextList.append('line1')
y2 = y1 + 1
ln2 = plot(x,y2,color+'^-')
legendList.append(ln2)
legendTextList.append('line2')
legend(legendList,legendTextList)
show()
def doPlots2(const,color):
legendList=[]
legendTextList=[]
y1=N.arange(0., 10, 1)+ const
x = arange(len(y1))
ln1 = plot(x,y1,color+'+-')
legendList.append(ln1)
legendTextList.append('line1')
y2 = y1 + 1
ln2 = plot(x,y2,color+'^-')
legendList.append(ln2)
legendTextList.append('line2')
legend(legendList,legendTextList)
show()
figure(1)
doPlots1(0,'r')
doPlots1(5,'b')
figure(2)
doPlots2(0,'r')
doPlots2(5,'b')
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
|
|
From: Darren D. <dd...@co...> - 2004-07-06 03:53:58
|
Hello,
Just wanted to report an error message.
file "...\dynamic_demo_wx.py" line 109, in onTimer
self.lines[0].setdata(self.ind,self.X[:,self.count])
IndexError: Index out of range
I am running WinXP, Matplotlib 0.54.2, wx 2.4.2.4, and started the
example from windows explorer. This error message repeats for some time,
then the example will run for a while, then the error message again,
back and forth.
--
Darren S. Dale
dd...@co...
PGP public key available
|
|
From: Jim B. <jb...@se...> - 2004-07-04 02:14:44
|
On Sat, 3 Jul 2004, John Hunter wrote:
> Make that
>
> l = Legend(self, handles, labels, loc)
>
> Should work - let me know if you have any more troubles.
>
Thanks John...i did actually try that before i sent my
previous email...sorry that the error messages were buried
under a bunch of other stuff. I did have a problem after
i added the self. Here is what i get (my hacked up legendDemp.py follows
the error messages):
floyd:/home/jbenson/python>python legendDemo.py
Traceback (most recent call last):
File "legendDemo.py", line 30, in ?
'upper left')
File "/usr/local/lib/python2.3/site-packages/matplotlib/figure.py", line
179, in legend
l = Legend(self, handles, labels, loc)
File "/usr/local/lib/python2.3/site-packages/matplotlib/legend.py", line
107, in __init__
self._texts = self._get_texts(labels, textleft, upper)
File "/usr/local/lib/python2.3/site-packages/matplotlib/legend.py", line
215, in _get_texts
HEIGHT = self._approx_text_height()
File "/usr/local/lib/python2.3/site-packages/matplotlib/legend.py", line
126, in _approx_text_height
return
self.FONTSIZE/72.0*self.figure.dpi.get()/self.parent.bbox.height()
AttributeError: 'NoneType' object has no attribute 'dpi'
floyd:/home/jbenson/python>
# legendDemo.py
from matplotlib.matlab import *
a = arange(0,3,.02)
b = arange(0,3,.02)
c=exp(a)
d=c.tolist()
d.reverse()
d = array(d)
ax = subplot(111)
lines = plot(a,c,'k--',a,d,'k:',a,c+d,'k')
bNotHacked = False
if bNotHacked:
legend(('Model length', 'Data length', 'Total message length'), 'upper
left')
else:
fig = gcf()
line1 = lines[0]
line2 = lines[1]
line3 = lines[2]
fig.legend((line1, line2, line3),
('Model length', 'Data length', 'Total message length'),
'upper left')
ax.set_ylim([-1,20])
ax.grid(0)
xlabel('Model complexity --->')
ylabel('Message length --->')
title('Minimum Message Length')
set(gca(), 'yticklabels', [])
set(gca(), 'xticklabels', [])
savefig('legend_demo_small', dpi=60)
savefig('legend_demo_large', dpi=120)
show()
~
Jim
|