[Matplotlib-users] Error due to unusual font file

2009-11-05 Thread Alan Jackson
Trying to get a colleague to start using python, he ran into trouble,
getting an error exit whenever he tried to fire up
ipython -pylab

After much searching, he figured it out... it appears that a small patch may be
in order. Here is his note :

 I found it: I have a font installed in my personal fonts 
 directory that has non-integral sides for the bounding box 
 of the font.
 
 Fortunately, it seems like once I move my ~/.fonts 
 directory off to the side and then run
 
 ipython -pylab
 
 then some of that configuration info must be cached, since I 
 am able to move my .fonts file back and still have my ipython 
 -pylab come up.
 
 The offending line is in the return statement below
 
 #Convert string the a python type
 _to_int = int
 _to_float = float
 _to_str =  str
 
 def _to_list_of_ints(s):
 s = s.replace(',', ' ')
 return [_to_int(val) for val in s.split()]
 
 and I think a fix would be along the lines of Alan's remark:
 
 return [_to_int(_to_float(val)) for val in s.split()]
 
 This is in the file
 
 /glb/apps/sss/epd/2.5.4.2.30201/lib/python2.5/site-packages/ma
 tplotlib-0.98.5.2n1-py2.5-linux-x86_64.egg/matplotlib/afm.py
 
 Anyway, it works for me.

-- 
---
| Alan K. Jackson| To see a World in a Grain of Sand  |
| a...@ajackson.org  | And a Heaven in a Wild Flower, |
| www.ajackson.org   | Hold Infinity in the palm of your hand |
| Houston, Texas | And Eternity in an hour. - Blake   |
---

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Matplotlib and Flash

2009-06-13 Thread Alan Jackson
Any suggestions for turning a sequence of Matplotlib plots into a Flash
movie, on Linux?

I did just notice that R now has that capability built in. 8-)

-- 
---
| Alan K. Jackson| To see a World in a Grain of Sand  |
| a...@ajackson.org  | And a Heaven in a Wild Flower, |
| www.ajackson.org   | Hold Infinity in the palm of your hand |
| Houston, Texas | And Eternity in an hour. - Blake   |
---

--
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Proselytizing Excel users

2009-03-06 Thread Alan Jackson
Pretty nice video trying to convince Excel users to try out R for
their graphics needs. Anyone inspired to do the same for python?

http://chartsgraphs.wordpress.com/2009/02/27/video-to-help-excel-users-get-familiar-with-r/

-- 
---
| Alan K. Jackson| To see a World in a Grain of Sand  |
| a...@ajackson.org  | And a Heaven in a Wild Flower, |
| www.ajackson.org   | Hold Infinity in the palm of your hand |
| Houston, Texas | And Eternity in an hour. - Blake   |
---

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] controlling tick label size

2009-02-08 Thread Alan Jackson
Trying to find a simple way to shrink the tick labels for this plot -
since I can have many tiny histograms, the labels need to be smaller,
but it isn't obvious to me how to simply shrink them.

code snippet...

num = len(datasets)
fig = plt.figure()
rows = np.int(np.sqrt(num))
cols = np.int(float(num)/float(rows)+.9)
for i in range(num):
ax = fig.add_subplot(rows, cols, i+1)
ax.hist(datasets[i][np.isfinite(datasets[i])], bins=60 )
ax.set_xlabel(labels[i], size = 9)
ax.set_ylabel('Counts', size = 9)
plt.show()


-- 
---
| Alan K. Jackson| To see a World in a Grain of Sand  |
| a...@ajackson.org  | And a Heaven in a Wild Flower, |
| www.ajackson.org   | Hold Infinity in the palm of your hand |
| Houston, Texas | And Eternity in an hour. - Blake   |
---

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] controlling tick label size

2009-02-08 Thread Alan Jackson
Never mind - I just saw the very timely e-mail from Jouni.

Thanks!

On Sun, 8 Feb 2009 14:16:59 -0600
Alan Jackson a...@ajackson.org wrote:

 Trying to find a simple way to shrink the tick labels for this plot -
 since I can have many tiny histograms, the labels need to be smaller,
 but it isn't obvious to me how to simply shrink them.
 
 code snippet...
 
 num = len(datasets)
 fig = plt.figure()
 rows = np.int(np.sqrt(num))
 cols = np.int(float(num)/float(rows)+.9)
 for i in range(num):
 ax = fig.add_subplot(rows, cols, i+1)
 ax.hist(datasets[i][np.isfinite(datasets[i])], bins=60 )
 ax.set_xlabel(labels[i], size = 9)
 ax.set_ylabel('Counts', size = 9)
 plt.show()
 
 
 -- 
 ---
 | Alan K. Jackson| To see a World in a Grain of Sand  |
 | a...@ajackson.org  | And a Heaven in a Wild Flower, |
 | www.ajackson.org   | Hold Infinity in the palm of your hand |
 | Houston, Texas | And Eternity in an hour. - Blake   |
 ---
 
 --
 Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
 software. With Adobe AIR, Ajax developers can use existing skills and code to
 build responsive, highly engaging applications that combine the power of local
 resources and data with the reach of the web. Download the Adobe AIR SDK and
 Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-- 
---
| Alan K. Jackson| To see a World in a Grain of Sand  |
| a...@ajackson.org  | And a Heaven in a Wild Flower, |
| www.ajackson.org   | Hold Infinity in the palm of your hand |
| Houston, Texas | And Eternity in an hour. - Blake   |
---

--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] open multiple plots from a program

2009-01-24 Thread Alan Jackson
I have been trying to figure out how to open up multiple plots from a
traits program, without much luck. I tried threads, no joy. Is there a
simple way to get multiple plots to come up? Would it work to fork off
new processes for each plot? I haven't done that in python before, just
perl, so before I dig too deeply into it, I thought I'd ask around.

-- 
---
| Alan K. Jackson| To see a World in a Grain of Sand  |
| a...@ajackson.org  | And a Heaven in a Wild Flower, |
| www.ajackson.org   | Hold Infinity in the palm of your hand |
| Houston, Texas | And Eternity in an hour. - Blake   |
---

--
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Filling between curves conditionally

2008-11-23 Thread Alan Jackson
On Sun, 23 Nov 2008 16:48:59 -0800
Zane Selvans [EMAIL PROTECTED] wrote:


 Incidentally, when you do it with ax.plot() instead you can see more  
 easily that the corners where the two sinusoidal functions intersect  
 are getting kind of chopped off by the polygon filling.  Don't know if  
 there's an easy way to fix that - maybe by forcing the list of polygon  
 vertices to always explicitly include the points of intersection  
 between the functions being filled_between?  Or maybe just by  
 increasing the number of vertices, though I assume that would slow  
 things down.

Some time back, I wrote code to generate a fairly complex polyfill in
a plot in R, 

http://www.oplnk.net/~ajackson/weather/Temperature_2000.png

The key bit of code to find the intersections between all the curves
to fill the corners correctly is here (note that this is R code):

intersect - function(a, b, c, d) {
#   test two line segments for intersection.
#   modified from segseg in Computational Geometry in C 
#   by Joseph O'Rourke

p = c(0,0)

   denom = a[1] * ( d[2] - c[2] ) +
   b[1] * ( c[2] - d[2] ) +
   d[1] * ( b[2] - a[2] ) +
   c[1] * ( a[2] - b[2] );

   # If denom is zero, then segments are parallel: handle separately. 
   if (abs(denom) = 1.0e-10) {
   return (c(p,0)) 
}

   num =a[1] * ( d[2] - c[2] ) +
c[1] * ( a[2] - d[2] ) +
d[1] * ( c[2] - a[2] );
   if ( (num == 0.0) || (num == denom) ) code = 0;
   s = num / denom;

   num = -( a[1] * ( c[2] - b[2] ) +
b[1] * ( a[2] - c[2] ) +
c[1] * ( b[2] - a[2] ) );
   if ( (num == 0.0) || (num == denom) ) code = 0;
   t = num / denom;

   if  ( (0.0  s)  (s  1.0) 
 (0.0  t)  (t  1.0) ) {
 code = 1;
 }
   else if ( (0.0  s) || (s  1.0) ||
 (0.0  t) || (t  1.0) ) {
 code = 0;
 }

   p[1] = a[1] + s * ( b[1] - a[1] );
   p[2] = a[2] + s * ( b[2] - a[2] );

   c(p,code);
}

#   Intersect two lines defined by a series of segments. Assume the
#   lines have common x-values and differ only in y
#   intersect is array of (x,y) values

intersect.lines - function (y1,y2,x) {
intersect = array(data = NA, dim = c(2,0), dimnames = NULL)
for (i in 2:length(x)) {
   a = c(x[i-1], y1[i-1])
   b = c(x[i], y1[i])
   c = c(x[i-1], y2[i-1])
   d = c(x[i], y2[i])
   foo = intersect(a,b,c,d)
   if (foo[3]) {
intersect = cbind(intersect, foo[1:2])
   }
}
intersect
}



-- 
---
| Alan K. Jackson| To see a World in a Grain of Sand  |
| [EMAIL PROTECTED]  | And a Heaven in a Wild Flower, |
| www.ajackson.org   | Hold Infinity in the palm of your hand |
| Houston, Texas | And Eternity in an hour. - Blake   |
---

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Non-linear Regression to a Histogram

2008-05-12 Thread Alan Jackson
I have an example of fitting distributions to bus arrival times using
'R' that may be helpful. I wanted to calculate the latest time I could
arrive at the bus stop and have a better than 95% chance of catching
the bus. I tend to use R and Scipy whereever each is strongest.

http://www.oplnk.net/~ajackson/software/
http://www.oplnk.net/~ajackson/software/BusStats.R

On Sun, 11 May 2008 18:49:58 -0500
glenn andrews [EMAIL PROTECTED] wrote:

 I have been working on a similar problem related to finance.  What I 
 have done is call the R statistical software from Python and then use 
 matplotlib for graphing within Python
 
 I use Python2.4,  the R statistical package, and a Python package 
 called rpy which interfaces to R from Python
 
 LINKs:
 http://rpy.sourceforge.net/
 http://www.r-project.org/
 
 My tendency is to submit the data to R which does the statistical 
 calculations, return the results to Python, and then use Matplotlib to 
 plot.  Keep in mind that R also has good plotting capabilities and you 
 might just go with that solution. 
 
 

 ###
 
 
 Eric Firing wrote:
 
 You might get a good answer here (although I don't have it), but be 
 aware that your question relates to math, not plotting, so it is not 
 really a matplotlib question.  You need nonlinear least-squares.  Look 
 in scipy, and try the amazing Google.
 
 Eric
 
 Adrian Price-Whelan wrote:
   
 
 Hey guys -
 
 I'm working on a Histogram of pixel values from an astronomical image  
 that looks like a Gaussian curve and then polynomial decay.  I'm  
 trying to figure out a way to fit a Gaussian regression to the  
 histogram, but can't find any documentation on this. thanks!
 
 -adrian
 
 
 
 -
 This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
 Don't miss this year's exciting event. There's still time to save $100. 
 Use priority code J8TL2D2. 
 http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
   
 
 
 
 -
 This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
 Don't miss this year's exciting event. There's still time to save $100. 
 Use priority code J8TL2D2. 
 http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-- 
---
| Alan K. Jackson| To see a World in a Grain of Sand  |
| [EMAIL PROTECTED]  | And a Heaven in a Wild Flower, |
| www.ajackson.org   | Hold Infinity in the palm of your hand |
| Houston, Texas | And Eternity in an hour. - Blake   |
---

-
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] displaying multiple plots

2008-02-04 Thread Alan Jackson
I've done this on my system at home, but it doesn't seem to be working at
work.

I generate a series of imshow() plots, each followed by a show() command.
When I run the script, it should pause after each show() until I exit the
plot, and then display the next plot. But now it isn't working. The first
plot gets displayed and pauses, and then it falls through to the end.

numpy 1.0.3.1, matplotlib 0.90.1

--
from numpy import arange, array, mgrid, cos, random
import scipy.stats as stats
import scipy.signal as signal

#---
#   2D filters
#---

#   from Scipy cookbook
def gauss_kern(size, sizey=None):
 Returns a normalized 2D gauss kernel array for convolutions 
size = int(size)
if not sizey:
sizey = size
else:
sizey = int(sizey)
x, y = mgrid[-size:size+1, -sizey:sizey+1]
g = exp(-(x**2/float(size)+y**2/float(sizey)))
return g / g.sum()

#   from Scipy cookbook
def blur_image(im, n, ny=None) :
 blurs the image by convolving with a gaussian kernel of typical
size n. The optional keyword argument ny allows for a different
size in the y direction.

g = gauss_kern(n, sizey=ny)
improc = signal.convolve(im,g, mode='valid')
return(improc)



#   test section


if __name__ == '__main__' :

X,Y = mgrid[-70:70,-70:70]
Z = cos((X**2+Y**2)/200.) + random.normal(size=X.shape)

from matplotlib.pylab import *

imshow(Z, hold=True)
show()

#   gaussian blur, 5x5

NewZ = blur_image(Z,15)
imshow(NewZ, hold=True)
show()
-
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plotting wind-speed time series (was: What kind of chart should I use?)

2007-05-04 Thread Alan Jackson
On Fri, 4 May 2007 12:15:13 -0700 (PDT)
[EMAIL PROTECTED] wrote:

 Saw this:
 
 http://www.originlab.com/www/products/GraphGallery.aspx?GID=26s=8lm=215
 
 Since I am not interested in wind direction, may be I can use stacked 
 bar-chart.   Still, how would I tie plot_data with it though?

I don't do what you are trying to do, but I do some other weather plots,
http://www.oplnk.net/~ajackson/weather/


-- 
---
| Alan K. Jackson| To see a World in a Grain of Sand  |
| [EMAIL PROTECTED]  | And a Heaven in a Wild Flower, |
| www.ajackson.org   | Hold Infinity in the palm of your hand |
| Houston, Texas | And Eternity in an hour. - Blake   |
---

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] type error complaint

2006-11-04 Thread Alan Jackson
A problem I don't understand with matplotlib. This used to work, until I 
upgraded. Now running 

dev-lang/python-2.4.3-r4
dev-python/numpy-1.0
dev-python/matplotlib-0.87.7
sci-libs/scipy-0.5.1-r1

on a Gentoo Linux system :

2.6.16-gentoo-r3
AMD Athlon 64 X2 3800+


$ ~/lib/python/weatherlib_alpha.py 
/usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/_core.py:13155: 
UserWarning: wxPython/wxWidgets release number mismatch
  warnings.warn(wxPython/wxWidgets release number mismatch)
/usr/lib/python2.4/calendar.py:105: DeprecationWarning: integer argument 
expected, got float
  return datetime.date(year, month, day).weekday()
/usr/lib/python2.4/site-packages/dateutil/relativedelta.py:271: 
DeprecationWarning: integer argument expected, got float
  ret = (other.replace(**repl)
Traceback (most recent call last):
  File /home/ajackson/lib/python/weatherlib_alpha.py, line 228, in ?
WD = wpanel(WD_defs)
  File /home/ajackson/lib/python/weatherlib_alpha.py, line 138, in __init__
self.Cax_c = figtext(0.84, .1, 'OOO')
  File /usr/lib/python2.4/site-packages/matplotlib/pylab.py, line 776, in 
figtext
draw_if_interactive()
  File /usr/lib/python2.4/site-packages/matplotlib/backends/backend_wx.py, 
line 1172, in draw_if_interactive
figManager.canvas.draw()
  File /usr/lib/python2.4/site-packages/matplotlib/backends/backend_wxagg.py, 
line 61, in draw
FigureCanvasAgg.draw(self)
  File /usr/lib/python2.4/site-packages/matplotlib/backends/backend_agg.py, 
line 392, in draw
self.figure.draw(renderer)
  File /usr/lib/python2.4/site-packages/matplotlib/figure.py, line 544, in 
draw
for a in self.axes: a.draw(renderer)
  File /usr/lib/python2.4/site-packages/matplotlib/axes.py, line 1063, in draw
a.draw(renderer)
  File /usr/lib/python2.4/site-packages/matplotlib/axis.py, line 559, in draw
tick.set_label1(label)
  File /usr/lib/python2.4/site-packages/matplotlib/axis.py, line 188, in 
set_label1
self.label1.set_text(s)
  File /usr/lib/python2.4/site-packages/matplotlib/text.py, line 671, in 
set_text
raise TypeError(This doesn't look like a string: '%s'%s)
TypeError: This doesn't look like a string: '0.0'


-- 
---
| Alan K. Jackson| To see a World in a Grain of Sand  |
| [EMAIL PROTECTED]  | And a Heaven in a Wild Flower, |
| www.ajackson.org   | Hold Infinity in the palm of your hand |
| Houston, Texas | And Eternity in an hour. - Blake   |
---

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users