Re: [Matplotlib-users] Manually enable export as EMF

2009-05-07 Thread Gert-Jan

Hey all,

I was just hoping anyone could help me further here... it would be highly
appreciated.

Thanks in advance,

Gert-Jan



Olivier Benoist wrote:
> 
> Hi,
> I'm new with matplotlib.
> 
> I need to make a graph with the X axis represents time in hours and
> minutes. My script don't works, I want to display all the values of time
> that I have.
> I use a list of string like this :
> t=['0015', '0030', '0045', '0100', '0115', '0130', '0145', '0200',
> '0215', '0230', '0245', '0300', '03
> 15', '0330', '0345', '0400', '0415', '0430', '0445', '0500', '0515',
> '0530', '0545', '0600', '0615',
>  '0630', '0645', '0700', '0715', '0730', '0745', '0800', '0815', '0830',
> '0845', '0900', '0915', '09
> 30', '0945', '1000', '1015', '1030', '1045', '1100', '1115', '1130',
> '1145', '1200', '1215', '1230',
>  '1245', '1300', '1315', '1330', '1345', '1400', '1415']
> 
> ax.plot(t, y)
> 
> I tried to convert hours and minutes to the base 100 ( , it works but I
> can not show on the x-axis the hours, minutes.
> I tried to use plot_date, but I don't understand "x and/or y can be a
> sequence of dates represented as float days since 0001-01-01 UTC."
> 
> Could you help me, please ?
> 
> /olivier
> 
> --
> Register Now & Save for Velocity, the Web Performance & Operations 
> Conference from O'Reilly Media. Velocity features a full day of 
> expert-led, hands-on workshops and two days of sessions from industry 
> leaders in dedicated Performance & Operations tracks. Use code vel09scf 
> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
> 
> 

I believe this needs its own thread. =)
-- 
View this message in context: 
http://www.nabble.com/Manually-enable-export-as-EMF-tp23293186p23422798.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] OS X binary installer broken on 10.4? (was: O pylab why do you refuse to import?)

2009-05-07 Thread Jouni K . Seppänen
John Seales  writes:

>> > I'm using python 2.5.2 on a macbook, intel microprocessor, mac os 10.4.11

> I installed matplotlib from the dmg file. I clicked on the icon to install it.

I assume you mean the mpkg file - I don't see any dmg file on the
download page. It seems to me that something is wrong with that file,
since release/osx/Makefile compiles its own Freetype and attempts to
link to it statically, but the file ft2font.so distributed within the
mpkg installer links dynamically to /usr/X11R6/lib/libfreetype.6.dylib.

AFAIK, the static linking is done precisely to avoid version mismatches
between different versions of freetype, zlib, and png on various
versions of OS X. Several *.so files within the mpkg link to
/usr/X11R6/lib/libfreetype.6.dylib and /usr/lib/libz.1.dylib (though,
curiously, none link to the system libpng).

I suppose this is exactly the kind of problem that results from dynamic
linking to a wrong version of freetype:

>> > ImportError: 
>> > dlopen(/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/ft2font.so,
>> >  2): Library not loaded: /usr/X11R6/lib/libfreetype.6.dylib
>> >   Referenced from: 
>> > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/ft2font.so
>> >   Reason: image not found


-- 
Jouni K. Seppänen
http://www.iki.fi/jks


--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 2 simple ??: program exit w/graph, update graph real-time

2009-05-07 Thread Robert Cimrman

Ryan May wrote:

On Wed, May 6, 2009 at 8:53 AM, Robert Cimrman  wrote:


Ryan May wrote:


On Wed, May 6, 2009 at 7:57 AM, Robert Cimrman 
wrote:


Just for the record: Ryan May's example in this thread, that uses pipes,
inspired me to try pipes as well, instead of queues
(multiprocessing.Pipe instead of Queue) and the "hanging problem", i.e.
the problem that Ctrl-C interrupted the program, but it had to be killed
to stop, disappeared. I can fix the script that I sent in message [1]
and provide it, if there is interest. (Currently I have fixed only the
version that is within sfepy).



I know I'd be interested.  With your permission, it might make a nice
example as well.


Permission granted :) I have sent the script in response to William.



Done.  I like the fact that with your example, everything is self-contained
in a single script.


Exactly, the details of starting another python process are hidden, the 
multiprocessing module is really nice.


You might want to add

import matplotlib
matplotlib.use('GtkAgg')

to the script, and remove "from Queue import Empty".

FYI: I am sending also a more complex example - a Log class used in 
sfepy, which supports multiple subplots, labels, logarithmic plots etc. 
The file contains some other support classes too, so that it works 
standalone. It is not very polished, but it serves its purpose.


r.



import matplotlib
matplotlib.use('GtkAgg')

import numpy as nm
from multiprocessing import Process, Pipe
from matplotlib.ticker import LogLocator, AutoLocator
import pylab
import gobject

def get_default( arg, default, msg_if_none = None ):

if arg is None:
out = default
else:
out = arg

if (out is None) and (msg_if_none is not None):
raise ValueError( msg_if_none )

return out

class Struct( object ):
def __init__( self, **kwargs ):
if kwargs:
self.__dict__.update( kwargs )

def __str__( self ):
"""Print instance class, name and items in alphabetical order."""
ss = "%s" % self.__class__.__name__
if hasattr( self, 'name' ):
ss += ":%s" % self.name
ss += '\n'

keys, vals = self.__dict__.keys(), self.__dict__.values()
order = nm.argsort(keys)
for ii in order:
key, val = keys[ii], vals[ii]

if issubclass( val.__class__, Struct ):
ss += "  %s:\n%s" % (key, val.__class__.__name__)
if hasattr( val, 'name' ):
ss += ":%s" % val.name
ss += '\n'
else:
aux = "\n" + str( val )
aux = aux.replace( "\n", "\n" );
ss += "  %s:\n%s\n" % (key, aux[1:])
return( ss.rstrip() )

def __repr__( self ):
ss = "%s" % self.__class__.__name__
if hasattr( self, 'name' ):
ss += ":%s" % self.name
return ss

class Output( Struct ):
"""Factory class providing output (print) functions.

Example:

>>> output = Output( 'sfepy:' )
>>> output( 1, 2, 3, 'hello' )
>>> output.prefix = 'my_cool_app:'
>>> output( 1, 2, 3, 'hello' )
"""

def __init__(self, prefix, filename=None, combined=False, **kwargs):
Struct.__init__(self, **kwargs)

self.prefix = prefix

self.set_output(filename, combined)

def __call__(self, *argc, **argv):
self.output_function(*argc, **argv)

def set_output(self, filename=None, combined=False, append=False):
"""Set the output function - all SfePy printing is accomplished by
it. If filename is None, output is to screen only, otherwise it is to
the specified file, moreover, if combined is True, both the ways are
used.

Arguments:
filename - print into this file
combined - print both on screen and into a file
append - append to an existing file instead of overwriting it
"""
self.level = 0
def output_screen( *argc, **argv ):
format = '%s' + ' %s' * (len( argc ) - 1)
msg =  format % argc

if msg.startswith( '...' ):
self.level -= 1

print self._prefix + ('  ' * self.level) + msg

if msg.endswith( '...' ):
self.level += 1

def output_file( *argc, **argv ):
format = '%s' + ' %s' * (len( argc ) - 1)
msg =  format % argc

if msg.startswith( '...' ):
self.level -= 1

fd = open( filename, 'a' )
print >>fd, self._prefix + ('  ' * self.level) + msg
fd.close()

if msg.endswith( '...' ):
self.level += 1

def output_combined( *argc, **argv ):
output_screen( *argc, **argv )
output_file( *argc, **argv )

if filename is None:
self.output_function = output_screen

else:
if not append:
  

[Matplotlib-users] logarithmic scale of colorbar with ticks and custom labels

2009-05-07 Thread Sebastian Pająk
Hello

I have a contour plot with specified number of levels (isolines):

lev = array([2,3,5,7,10,13,17,21,26,32,42,62,80,100,120,140,180])

to have a log "z" axis I put:

from matplotlib import colors
contourf(x1, y1, z1, lev, norm=colors.LogNorm(lev[0],lev[len(lev)-1]))

now, to get colorbar in log scale:

from matplotlib.ticker import LogLocator, LogFormatter
l_f = LogFormatter(10, labelOnlyBase=False)
cbar = colorbar(format = l_f)

But the colorbar doesn't have all tick's labels specified in "lev"
variable. Ticks are placed correctly on the cbar, but only every
second tick has a text label (yes 2, 5, 10 ... etc). What should I do
to have ALL levels on colorbar labeled?

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] logarithmic scale of colorbar with ticks and custom labels

2009-05-07 Thread Jae-Joon Lee
http://matplotlib.sourceforge.net/api/figure_api.html?highlight=colorbar#matplotlib.figure.Figure.colorbar

cbar = colorbar(ticks=lev, format = l_f)

-JJ


On Wed, May 6, 2009 at 3:28 PM, Sebastian Pająk  wrote:
> Hello
>
> I have a contour plot with specified number of levels (isolines):
>
> lev = array([2,3,5,7,10,13,17,21,26,32,42,62,80,100,120,140,180])
>
> to have a log "z" axis I put:
>
> from matplotlib import colors
> contourf(x1, y1, z1, lev, norm=colors.LogNorm(lev[0],lev[len(lev)-1]))
>
> now, to get colorbar in log scale:
>
> from matplotlib.ticker import LogLocator, LogFormatter
> l_f = LogFormatter(10, labelOnlyBase=False)
> cbar = colorbar(format = l_f)
>
> But the colorbar doesn't have all tick's labels specified in "lev"
> variable. Ticks are placed correctly on the cbar, but only every
> second tick has a text label (yes 2, 5, 10 ... etc). What should I do
> to have ALL levels on colorbar labeled?
>
> --
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Wxpython, Matplotlib and draw_artist

2009-05-07 Thread Michiel de Hoon

I am not sure if this is related, but maybe it can give you a hint.
I looked at the copy_from_bbox/restore/draw_artist code a long time ago, and if 
I remember correctly by calling restore_region function, you're drawing 
directly onto the canvas. In contrast, if you do e.g. plot(x,y), you're not 
drawing directly; you're just telling matplotlib what you want to plot, but the 
actual plotting is done by matplotlib by calling figure.draw(renderer). 
Typically, this happens from inside the event loop, which is how things are 
supposed to be. On the other hand, restore_region bypasses the event loop, 
which is usually not a good idea.

--Michiel




--- On Wed, 5/6/09, Elan Pavlov  wrote:

> From: Elan Pavlov 
> Subject: [Matplotlib-users] Wxpython, Matplotlib and draw_artist
> To: matplotlib-users@lists.sourceforge.net
> Date: Wednesday, May 6, 2009, 2:05 PM
> Hi,
> I can't get wxpython to play well with matplotlib and
> draw_artist.
> After mucking around quite a bit I think I narrowed it down
> to the
> draw_artist function The problem seems to be that
> draw_artist when
> working within wxpython (as opposed to a simple mpl window)
> doesn't
> remove the old points it plotted. I adapted the example
> from the
> cookbook
> (http://www.scipy.org/Cookbook/Matplotlib/Animations) to
> illustrate this problem. I modified the example so it is
> updated on
> mouse movements (followed by idle time) so that the problem
> is more
> visual.
> 
> Replacing the copy_from_bbox/restore/draw_artist (i.e.
> removing the
> animated properties) with the simple draw causes this to
> work. The
> copy_from_bbox/restore methods work as expected so it seems
> that the
> problem is either the draw_artist (or possibly the blit,
> but that
> seems unlikely).
> 
> Is there something I am doing wrong?
> 
> Elan
> -- 
> Beware of bugs in the above code; I have only proved it
> correct, not tried it.
> - Donald Knuth
> --
> The NEW KODAK i700 Series Scanners deliver under ANY
> circumstances! Your
> production scanning environment may not be a perfect world
> - but thanks to
> Kodak, there's a perfect scanner to get the job done!
> With the NEW KODAK i700
> Series Scanner you'll get full speed at 300 dpi even
> with all image 
> processing features enabled.
> http://p.sf.net/sfu/kodak-com___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


  

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Wxpython, Matplotlib and draw_artist

2009-05-07 Thread Elan Pavlov
Hi,
By George, I think you've got it! That does explain the fact that old
lines remain since the restore_background is what should  remove them.
To test out your hypotheses I added sleep commands after every line in
the update_line()  function and indeed a blank axes never appears.
Looks like we have the culprit. Is this a bug or an undocumented
feature and is there anything I should do about it (i.e., report it)?
More importantly, do you have any idea how to fix the problem or how
the event interactions with wxpython work? Is it even feasible to do a
restore_canvas within the event loop or will this slow it down to the
extent of being useless?

Elan
---
I can no other answer make but thanks,
And thanks, and ever thanks.
- William Shakespeare

On Thu, May 7, 2009 at 9:17 AM, Michiel de Hoon  wrote:
>
> I am not sure if this is related, but maybe it can give you a hint.
> I looked at the copy_from_bbox/restore/draw_artist code a long time ago, and 
> if I remember correctly by calling restore_region function, you're drawing 
> directly onto the canvas. In contrast, if you do e.g. plot(x,y), you're not 
> drawing directly; you're just telling matplotlib what you want to plot, but 
> the actual plotting is done by matplotlib by calling figure.draw(renderer). 
> Typically, this happens from inside the event loop, which is how things are 
> supposed to be. On the other hand, restore_region bypasses the event loop, 
> which is usually not a good idea.
>
> --Michiel
>
>
>
>
> --- On Wed, 5/6/09, Elan Pavlov  wrote:
>
>> From: Elan Pavlov 
>> Subject: [Matplotlib-users] Wxpython, Matplotlib and draw_artist
>> To: matplotlib-users@lists.sourceforge.net
>> Date: Wednesday, May 6, 2009, 2:05 PM
>> Hi,
>> I can't get wxpython to play well with matplotlib and
>> draw_artist.
>> After mucking around quite a bit I think I narrowed it down
>> to the
>> draw_artist function The problem seems to be that
>> draw_artist when
>> working within wxpython (as opposed to a simple mpl window)
>> doesn't
>> remove the old points it plotted. I adapted the example
>> from the
>> cookbook
>> (http://www.scipy.org/Cookbook/Matplotlib/Animations) to
>> illustrate this problem. I modified the example so it is
>> updated on
>> mouse movements (followed by idle time) so that the problem
>> is more
>> visual.
>>
>> Replacing the copy_from_bbox/restore/draw_artist (i.e.
>> removing the
>> animated properties) with the simple draw causes this to
>> work. The
>> copy_from_bbox/restore methods work as expected so it seems
>> that the
>> problem is either the draw_artist (or possibly the blit,
>> but that
>> seems unlikely).
>>
>> Is there something I am doing wrong?
>>
>> Elan
>> --
>> Beware of bugs in the above code; I have only proved it
>> correct, not tried it.
>> - Donald Knuth
>> --
>> The NEW KODAK i700 Series Scanners deliver under ANY
>> circumstances! Your
>> production scanning environment may not be a perfect world
>> - but thanks to
>> Kodak, there's a perfect scanner to get the job done!
>> With the NEW KODAK i700
>> Series Scanner you'll get full speed at 300 dpi even
>> with all image
>> processing features enabled.
>> http://p.sf.net/sfu/kodak-com___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] logarithmic scale of colorbar with ticks and custom labels

2009-05-07 Thread Sebastian Pająk
OK works. I didn't notice the ticks arg. Thanks again

Sebastian

2009/5/7 Jae-Joon Lee :
> http://matplotlib.sourceforge.net/api/figure_api.html?highlight=colorbar#matplotlib.figure.Figure.colorbar
>
> cbar = colorbar(ticks=lev, format = l_f)
>
> -JJ
>
>
> On Wed, May 6, 2009 at 3:28 PM, Sebastian Pająk  wrote:
>> Hello
>>
>> I have a contour plot with specified number of levels (isolines):
>>
>> lev = array([2,3,5,7,10,13,17,21,26,32,42,62,80,100,120,140,180])
>>
>> to have a log "z" axis I put:
>>
>> from matplotlib import colors
>> contourf(x1, y1, z1, lev, norm=colors.LogNorm(lev[0],lev[len(lev)-1]))
>>
>> now, to get colorbar in log scale:
>>
>> from matplotlib.ticker import LogLocator, LogFormatter
>> l_f = LogFormatter(10, labelOnlyBase=False)
>> cbar = colorbar(format = l_f)
>>
>> But the colorbar doesn't have all tick's labels specified in "lev"
>> variable. Ticks are placed correctly on the cbar, but only every
>> second tick has a text label (yes 2, 5, 10 ... etc). What should I do
>> to have ALL levels on colorbar labeled?
>>
>> --
>> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
>> production scanning environment may not be a perfect world - but thanks to
>> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
>> Series Scanner you'll get full speed at 300 dpi even with all image
>> processing features enabled. http://p.sf.net/sfu/kodak-com
>> ___
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>
>

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Wxpython, Matplotlib and draw_artist

2009-05-07 Thread Michiel de Hoon

> Looks like we have the culprit. Is this a bug or an
> undocumented feature 

I think that the current code is a bit of a hack that sometimes works and 
sometimes doesn't, depending on which backend you use.

> and is there anything I should do about it (i.e.,
> report it)?

Yes, I think so. It's not super difficult to find a solution, but it will need 
some discussion with the matplotlib developers to find the best way to fit this 
in with the existing matplotlib code.

> More importantly, do you have any idea how to fix the
> problem 

In principle, it's simple. You'll need to split up the restore_background 
function in a frontend_restore_background and a backend_restore_background 
(arbitrary names, of course). The frontend_restore_background is what the user 
uses to tell matplotlib which background should be restored where. Inside the 
event loop, the backend_restore_background uses this information to do the 
actual blitting.

> or how the event interactions with wxpython work?

I don't think it matters much, as long as the actual drawing is done from 
inside figure.draw(renderer).

> Is it even feasible to do a
> restore_canvas within the event loop

Absolutely. There is no essential difference between drawing a line or blitting 
a background. Imagine the code in figure.draw(renderer) to be something along 
the lines of

blit a background, if any
draw the lines, if any
fill shapes with color, if any
draw the text, if any
...

> or will this slow it down to the extent of being useless?

I wouldn't know why.

--Michiel.


--- On Thu, 5/7/09, Elan Pavlov  wrote:

> From: Elan Pavlov 
> Subject: Re: [Matplotlib-users] Wxpython, Matplotlib and draw_artist
> To: mjldeh...@yahoo.com
> Cc: matplotlib-users@lists.sourceforge.net
> Date: Thursday, May 7, 2009, 10:23 AM
> Hi,
> By George, I think you've got it! That does explain the
> fact that old
> lines remain since the restore_background is what should 
> remove them.
> To test out your hypotheses I added sleep commands after
> every line in
> the update_line()  function and indeed a blank axes never
> appears.
> Looks like we have the culprit. Is this a bug or an
> undocumented
> feature and is there anything I should do about it (i.e.,
> report it)?
> More importantly, do you have any idea how to fix the
> problem or how
> the event interactions with wxpython work? Is it even
> feasible to do a
> restore_canvas within the event loop or will this slow it
> down to the
> extent of being useless?
> 
> Elan
> ---
> I can no other answer make but thanks,
> And thanks, and ever thanks.
> - William Shakespeare
> 
> On Thu, May 7, 2009 at 9:17 AM, Michiel de Hoon
>  wrote:
> >
> > I am not sure if this is related, but maybe it can
> give you a hint.
> > I looked at the copy_from_bbox/restore/draw_artist
> code a long time ago, and if I remember correctly by calling
> restore_region function, you're drawing directly onto
> the canvas. In contrast, if you do e.g. plot(x,y),
> you're not drawing directly; you're just telling
> matplotlib what you want to plot, but the actual plotting is
> done by matplotlib by calling figure.draw(renderer).
> Typically, this happens from inside the event loop, which is
> how things are supposed to be. On the other hand,
> restore_region bypasses the event loop, which is usually not
> a good idea.
> >
> > --Michiel
> >
> >
> >
> >
> > --- On Wed, 5/6/09, Elan Pavlov
>  wrote:
> >
> >> From: Elan Pavlov 
> >> Subject: [Matplotlib-users] Wxpython, Matplotlib
> and draw_artist
> >> To: matplotlib-users@lists.sourceforge.net
> >> Date: Wednesday, May 6, 2009, 2:05 PM
> >> Hi,
> >> I can't get wxpython to play well with
> matplotlib and
> >> draw_artist.
> >> After mucking around quite a bit I think I
> narrowed it down
> >> to the
> >> draw_artist function The problem seems to be that
> >> draw_artist when
> >> working within wxpython (as opposed to a simple
> mpl window)
> >> doesn't
> >> remove the old points it plotted. I adapted the
> example
> >> from the
> >> cookbook
> >>
> (http://www.scipy.org/Cookbook/Matplotlib/Animations) to
> >> illustrate this problem. I modified the example so
> it is
> >> updated on
> >> mouse movements (followed by idle time) so that
> the problem
> >> is more
> >> visual.
> >>
> >> Replacing the copy_from_bbox/restore/draw_artist
> (i.e.
> >> removing the
> >> animated properties) with the simple draw causes
> this to
> >> work. The
> >> copy_from_bbox/restore methods work as expected so
> it seems
> >> that the
> >> problem is either the draw_artist (or possibly the
> blit,
> >> but that
> >> seems unlikely).
> >>
> >> Is there something I am doing wrong?
> >>
> >> Elan
> >> --
> >> Beware of bugs in the above code; I have only
> proved it
> >> correct, not tried it.
> >> - Donald Knuth
> >>
> --
> >> The NEW KODAK i700 Series Scanners deliver under
> ANY
> >> circumstances! Your
> >> production scanning environment may not

Re: [Matplotlib-users] Wxpython, Matplotlib and draw_artist

2009-05-07 Thread John Hunter
On Wed, May 6, 2009 at 1:05 PM, Elan Pavlov  wrote:
> Hi,
> I can't get wxpython to play well with matplotlib and draw_artist.
> After mucking around quite a bit I think I narrowed it down to the
> draw_artist function The problem seems to be that draw_artist when
> working within wxpython (as opposed to a simple mpl window) doesn't
> remove the old points it plotted. I adapted the example from the
> cookbook (http://www.scipy.org/Cookbook/Matplotlib/Animations) to
> illustrate this problem. I modified the example so it is updated on
> mouse movements (followed by idle time) so that the problem is more
> visual.
>
> Replacing the copy_from_bbox/restore/draw_artist (i.e. removing the
> animated properties) with the simple draw causes this to work. The
> copy_from_bbox/restore methods work as expected so it seems that the
> problem is either the draw_artist (or possibly the blit, but that
> seems unlikely).
>
> Is there something I am doing wrong?

You need to make sure that the background you copy on the initial draw
(with the artist animate so it won't be drawn) is large enough to
cover the entire artist on subsequent draws.  This is the background
and will be used to "erase" subsequent draws of the animated artist.
Then you draw the artist and blit the region.  When you are ready to
update with new data, restore the background (this erases all the old
points as long as the background region is large enough) and then
redraw/reblit.

JDH

>
> Elan
> --
> Beware of bugs in the above code; I have only proved it correct, not tried it.
> - Donald Knuth
>
> --
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] O pylab why do you refuse to import?

2009-05-07 Thread John Seales

Victory!

Turns out that libfreetype in X11 has a bug with mac os 10.4.11. I found out 
how to fix it on http://forums.macosxhints.com/archive/index.php/t-98792.html . 
The new libfreetype, once in the right spot and called libfreetype.6.dylib 
seems to work.

Thanks, Chris, for helping me. 

From: praxbaf...@hotmail.com
To: matplotlib-users@lists.sourceforge.net
Date: Wed, 6 May 2009 17:44:12 -0700
Subject: Re: [Matplotlib-users] O pylab why do you refuse to import?








I do have X11. It looks like there's a problem with the libfreetype, but I 
don't understand what the problem is. 

john-seales-computer:/ johnseales$ file /usr/X11R6/lib/libfreetype.6.dylib
/usr/X11R6/lib/libfreetype.6.dylib: cannot open 
(/usr/X11R6/lib/libfreetype.6.dylib)

john-seales-computer:/ johnseales$ file /usr/X11R6/lib/libfreetype.6.3.dylib
/usr/X11R6/lib/libfreetype.6.3.dylib: Mach-O universal binary with 2 
architectures
/usr/X11R6/lib/libfreetype.6.3.dylib (for architecture ppc):Mach-O dynamically 
linked shared library ppc
/usr/X11R6/lib/libfreetype.6.3.dylib (for architecture i386):   Mach-O 
dynamically linked shared library i386

> Date: Wed, 6 May 2009 16:55:23 -0700
> From: chris.bar...@noaa.gov
> To: matplotlib-users@lists.sourceforge.net
> Subject: Re: [Matplotlib-users] O pylab why do you refuse to import?
> 
> note: make sure to include the list, it doesn't look like you did.
> 
> John Seales wrote:
> > Here's what it says:
> > 
> > $ file ft2font.so
> > ft2font.so: Mach-O universal binary with 2 architectures
> > ft2font.so (for architecture i386): Mach-O bundle i386
> > ft2font.so (for architecture ppc):  Mach-O bundle ppc
> 
> that's right, but now I see that that wasn't the issue anyway:
> 
> >  > > ImportError: 
> > dlopen(/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/ft2font.so,
> >  
> > 2): Library not loaded: /usr/X11R6/lib/libfreetype.6.dylib
> >  > > Referenced from: 
> > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/ft2font.so
> 
> ft2font is relying on libfreetype. I think that's the one that Apple 
> delivers with their X11 (I know I have it, anyway), but I think X11 is 
> an optional install, so you may not have it.
> 
> Is that file there? ON my system:
> 
> $ file /usr/X11R6/lib/libfreetype.6.dylib
> /usr/X11R6/lib/libfreetype.6.dylib: symbolic link to `libfreetype.6.3.dylib'
> 
> and
> 
> $ file /usr/X11R6/lib/libfreetype.6.3.dylib
> /usr/X11R6/lib/libfreetype.6.3.dylib: Mach-O dynamically linked shared 
> library ppc
> 
> so I have it, and it's a ppc lib, which makes sense, as I'm running on a 
> ppc machine.
> 
> 
> If you don't have it, probably the easiest thing to do is install 
> Apple's X11 -- otherwise, perhaps MPL should be built against a static 
> libfreetype.
> 
> -Chris
> 
> 
> 
> 
> 
> -- 
> Christopher Barker, Ph.D.
> Oceanographer
> 
> Emergency Response Division
> NOAA/NOS/OR&R(206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115   (206) 526-6317   main reception
> 
> chris.bar...@noaa.gov
> 
> --
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
> Series Scanner you'll get full speed at 300 dpi even with all image 
> processing features enabled. http://p.sf.net/sfu/kodak-com
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Hotmail® goes with you.  Get it on your BlackBerry or iPhone.
_
Hotmail® has a new way to see what's up with your friends.
http://windowslive.com/Tutorial/Hotmail/WhatsNew?ocid=TXT_TAGLM_WL_HM_Tutorial_WhatsNew1_052009--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] O pylab why do you refuse to import?

2009-05-07 Thread John Seales

Victory!

Turns out that libfreetype in X11 has a bug with mac os 10.4.11. I found out 
how to fix it on http://forums.macosxhints.com/archive/index.php/t-98792.html . 
The new libfreetype, once in the right spot and called libfreetype.6.dylib 
seems to work.

Thanks, Chris, for helping me. 

From: praxbaf...@hotmail.com
To: matplotlib-users@lists.sourceforge.net
Date: Wed, 6 May 2009 17:44:12 -0700
Subject: Re: [Matplotlib-users] O pylab why do you refuse to import?








I do have X11. It looks like there's a problem with the libfreetype, but I 
don't understand what the problem is. 

john-seales-computer:/ johnseales$ file /usr/X11R6/lib/libfreetype.6.dylib
/usr/X11R6/lib/libfreetype.6.dylib: cannot open 
(/usr/X11R6/lib/libfreetype.6.dylib)

john-seales-computer:/ johnseales$ file /usr/X11R6/lib/libfreetype.6.3.dylib
/usr/X11R6/lib/libfreetype.6.3.dylib: Mach-O universal binary with 2 
architectures
/usr/X11R6/lib/libfreetype.6.3.dylib (for architecture ppc):Mach-O dynamically 
linked shared library ppc
/usr/X11R6/lib/libfreetype.6.3.dylib (for architecture i386):   Mach-O 
dynamically linked shared library i386

> Date: Wed, 6 May 2009 16:55:23 -0700
> From: chris.bar...@noaa.gov
> To: matplotlib-users@lists.sourceforge.net
> Subject: Re: [Matplotlib-users] O pylab why do you refuse to import?
> 
> note: make sure to include the list, it doesn't look like you did.
> 
> John Seales wrote:
> > Here's what it says:
> > 
> > $ file ft2font.so
> > ft2font.so: Mach-O universal binary with 2 architectures
> > ft2font.so (for architecture i386): Mach-O bundle i386
> > ft2font.so (for architecture ppc):  Mach-O bundle ppc
> 
> that's right, but now I see that that wasn't the issue anyway:
> 
> >  > > ImportError: 
> > dlopen(/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/ft2font.so,
> >  
> > 2): Library not loaded: /usr/X11R6/lib/libfreetype.6.dylib
> >  > > Referenced from: 
> > /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/matplotlib/ft2font.so
> 
> ft2font is relying on libfreetype. I think that's the one that Apple 
> delivers with their X11 (I know I have it, anyway), but I think X11 is 
> an optional install, so you may not have it.
> 
> Is that file there? ON my system:
> 
> $ file /usr/X11R6/lib/libfreetype.6.dylib
> /usr/X11R6/lib/libfreetype.6.dylib: symbolic link to `libfreetype.6.3.dylib'
> 
> and
> 
> $ file /usr/X11R6/lib/libfreetype.6.3.dylib
> /usr/X11R6/lib/libfreetype.6.3.dylib: Mach-O dynamically linked shared 
> library ppc
> 
> so I have it, and it's a ppc lib, which makes sense, as I'm running on a 
> ppc machine.
> 
> 
> If you don't have it, probably the easiest thing to do is install 
> Apple's X11 -- otherwise, perhaps MPL should be built against a static 
> libfreetype.
> 
> -Chris
> 
> 
> 
> 
> 
> -- 
> Christopher Barker, Ph.D.
> Oceanographer
> 
> Emergency Response Division
> NOAA/NOS/OR&R(206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115   (206) 526-6317   main reception
> 
> chris.bar...@noaa.gov
> 
> --
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
> Series Scanner you'll get full speed at 300 dpi even with all image 
> processing features enabled. http://p.sf.net/sfu/kodak-com
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Hotmail® goes with you.  Get it on your BlackBerry or iPhone.
_
Hotmail® goes with you. 
http://windowslive.com/Tutorial/Hotmail/Mobile?ocid=TXT_TAGLM_WL_HM_Tutorial_Mobile1_052009--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] O pylab why do you refuse to import?

2009-05-07 Thread Christopher Barker
John Seales wrote:
> Turns out that libfreetype in X11 has a bug with mac os 10.4.11. I found 
> out how to fix it on 
> http://forums.macosxhints.com/archive/index.php/t-98792.html . The new 
> libfreetype, once in the right spot and called libfreetype.6.dylib seems 
> to work.

If it works, you're probably done, but, for the sake of completeness, 
what do you get from:

$ ls -l  /usr/X11R6/lib/libfreetype*

-rw-r--r--   1 root  wheel  348476 Jan 21 07:27
/usr/X11R6/lib/libfreetype.6.3.dylib

lrwxr-xr-x   1 root  wheel  21 Aug 14  2008
/usr/X11R6/lib/libfreetype.6.dylib -> libfreetype.6.3.dylib

-rw-r--r--   1 root  wheel  831260 Mar 23  2007 /usr/X11R6/lib/libfreetype.a

lrwxr-xr-x   1 root  wheel  21 Aug 14  2008 
/usr/X11R6/lib/libfreetype.dylib -> libfreetype.6.3.dylib

This is the traditional *nix convention:

the real lib is libfreetype.6.3.dylib  (major an minor version specified)

The other ones are links to it.

I suspect that you where missing the libfreetype.6.dylib link before, 
and that you may now have a full lib there, rather than a link. Which 
probably is fine, but not quite standard.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] OS X binary installer broken on 10.4?

2009-05-07 Thread Christopher Barker
Jouni K. Seppänen wrote:
> AFAIK, the static linking is done precisely to avoid version mismatches
> between different versions of freetype, zlib, and png on various
> versions of OS X.

Well, it was done originally because all those libs weren't there at all 
originally. Apple has slowly been adding more (and the first freetype 
they included was not compatible with MPL in some way)

But yes, if there are different versions floating around static linking 
is a good idea.


  Several *.so files within the mpkg link to
> /usr/X11R6/lib/libfreetype.6.dylib and /usr/lib/libz.1.dylib (though,
> curiously, none link to the system libpng).

I think zlib as been pretty reliable, freetype not so much, and I don't 
think Apple provides libpng at all (I've got a whole bunch of copies on 
my system that came with various packages -- but none in system locations)

> I suppose this is exactly the kind of problem that results from dynamic
> linking to a wrong version of freetype:

In this case, I think a symlink was missing -- which looks like an Apple 
bug, but I can't tell you why it didn't bite me -- I suppose it depends 
on what order you installed/upgraded things.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov


--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] O pylab why do you refuse to import?

2009-05-07 Thread Brian Granger
I too have been bit by related freetype problems...

Is there a way of telling matplotlib which freetype dylib to use on OS
X?  I have multiple installed and it finds the wrong one by default.
I can probably go and hack on the setup.py/setupext.py to do this but
I am hoping there is any easier way.

Thanks,

Brian



On Thu, May 7, 2009 at 9:07 AM, Christopher Barker
 wrote:
> John Seales wrote:
>> Turns out that libfreetype in X11 has a bug with mac os 10.4.11. I found
>> out how to fix it on
>> http://forums.macosxhints.com/archive/index.php/t-98792.html . The new
>> libfreetype, once in the right spot and called libfreetype.6.dylib seems
>> to work.
>
> If it works, you're probably done, but, for the sake of completeness,
> what do you get from:
>
> $ ls -l  /usr/X11R6/lib/libfreetype*
>
> -rw-r--r--   1 root  wheel  348476 Jan 21 07:27
> /usr/X11R6/lib/libfreetype.6.3.dylib
>
> lrwxr-xr-x   1 root  wheel      21 Aug 14  2008
> /usr/X11R6/lib/libfreetype.6.dylib -> libfreetype.6.3.dylib
>
> -rw-r--r--   1 root  wheel  831260 Mar 23  2007 /usr/X11R6/lib/libfreetype.a
>
> lrwxr-xr-x   1 root  wheel      21 Aug 14  2008
> /usr/X11R6/lib/libfreetype.dylib -> libfreetype.6.3.dylib
>
> This is the traditional *nix convention:
>
> the real lib is libfreetype.6.3.dylib  (major an minor version specified)
>
> The other ones are links to it.
>
> I suspect that you where missing the libfreetype.6.dylib link before,
> and that you may now have a full lib there, rather than a link. Which
> probably is fine, but not quite standard.
>
> -Chris
>
>
>
> --
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
>
> chris.bar...@noaa.gov
>
> --
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] O pylab why do you refuse to import?

2009-05-07 Thread Christopher Barker
Brian Granger wrote:
> I too have been bit by related freetype problems...
> 
> Is there a way of telling matplotlib which freetype dylib to use on OS
> X?

at run time, no. At built time, then:

> I can probably go and hack on the setup.py/setupext.py 

that's how.

The tough part is that AFAICT, there is no way to specify a particular 
lib to link to, rather, you specify where to look for libs, so you need 
to make sure that it's looking where you want before where you don't want.

Ideally, the MPL community would decide on which is the "canonical" 
choice, and that would be how setup.py would be written. But there are 
so many options, it's hard to come to consensus.

Personally, I'd like to see the "Kyng Chaos" frameworks be the 
"standard" basis for python extension binaries:

http://www.kyngchaos.com/software:frameworks


That's a pretty complete set, and would support MPL, PIL, etc, etc

But it seems folks prefer to do static linking for distributed binaries, 
which is good too, but a bit tricky, as gcc really prefers to 
dynamically link -- it's easy to accidentally include a dynamic link 
without realizing it.

-Chris



-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 2 simple ??: program exit w/graph, update graph real-time

2009-05-07 Thread Eric Firing
Robert Cimrman wrote:
> Ryan May wrote:
>> On Wed, May 6, 2009 at 8:53 AM, Robert Cimrman  
>> wrote:
>>
>>> Ryan May wrote:

In case you are not receiving the automatic svn commit messages: 
yesterday I took the liberty of renaming log.py to multiprocess.py, 
because as far as I could see the former gave no clue as to the point of 
the example.  Feel free to change it back, or change it to something 
else, if you think I am mistaken or confused about this.

Eric

>>>
 On Wed, May 6, 2009 at 7:57 AM, Robert Cimrman 
 wrote:

> Just for the record: Ryan May's example in this thread, that uses 
> pipes,
> inspired me to try pipes as well, instead of queues
> (multiprocessing.Pipe instead of Queue) and the "hanging problem", 
> i.e.
> the problem that Ctrl-C interrupted the program, but it had to be 
> killed
> to stop, disappeared. I can fix the script that I sent in message [1]
> and provide it, if there is interest. (Currently I have fixed only the
> version that is within sfepy).
>

 I know I'd be interested.  With your permission, it might make a nice
 example as well.

>>> Permission granted :) I have sent the script in response to William.
>>>
>>>
>> Done.  I like the fact that with your example, everything is 
>> self-contained
>> in a single script.
> 
> Exactly, the details of starting another python process are hidden, the 
> multiprocessing module is really nice.
> 
> You might want to add
> 
> import matplotlib
> matplotlib.use('GtkAgg')
> 
> to the script, and remove "from Queue import Empty".
> 
> FYI: I am sending also a more complex example - a Log class used in 
> sfepy, which supports multiple subplots, labels, logarithmic plots etc. 
> The file contains some other support classes too, so that it works 
> standalone. It is not very polished, but it serves its purpose.
> 
> r.
> 
> 
> 
> 
> 
> 
> --
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
> Series Scanner you'll get full speed at 300 dpi even with all image 
> processing features enabled. http://p.sf.net/sfu/kodak-com
> 
> 
> 
> 
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 2 simple ??: program exit w/graph, update graph real-time

2009-05-07 Thread Ryan May
On Thu, May 7, 2009 at 12:39 PM, Eric Firing  wrote:

> In case you are not receiving the automatic svn commit messages: yesterday
> I took the liberty of renaming log.py to multiprocess.py, because as far as
> I could see the former gave no clue as to the point of the example.  Feel
> free to change it back, or change it to something else, if you think I am
> mistaken or confused about this.


No, I think that is a much better name in terms of why that demo exists in
matplotlib.  It was only in my haste to commit it that I didn't think about
renaming it.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] 2 simple ??: program exit w/graph, update graph real-time

2009-05-07 Thread Robert Cimrman
Ryan May wrote:
> On Thu, May 7, 2009 at 12:39 PM, Eric Firing  wrote:
> 
>> In case you are not receiving the automatic svn commit messages: yesterday
>> I took the liberty of renaming log.py to multiprocess.py, because as far as
>> I could see the former gave no clue as to the point of the example.  Feel
>> free to change it back, or change it to something else, if you think I am
>> mistaken or confused about this.
> 
> 
> No, I think that is a much better name in terms of why that demo exists in
> matplotlib.  It was only in my haste to commit it that I didn't think about
> renaming it.

Yes, it is a better name.

Of course, you can also add the log2.py script to the matplotlib example 
s(renamed to multiprocess_complex.py?) if you wish.

cheers,
r.

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] I need all value on X(hours, minutes) label

2009-05-07 Thread Ryan May
On Mon, May 4, 2009 at 9:49 AM, Olivier Benoist <
olivier.beno...@ericsson.com> wrote:

> Hi,
> I'm new with matplotlib.
>
> I need to make a graph with the X axis represents time in hours and
> minutes. My script don't works, I want to display all the values of time
> that I have.
> I use a list of string like this :
> t=['0015', '0030', '0045', '0100', '0115', '0130', '0145', '0200',
> '0215', '0230', '0245', '0300', '03
> 15', '0330', '0345', '0400', '0415', '0430', '0445', '0500', '0515',
> '0530', '0545', '0600', '0615',
>  '0630', '0645', '0700', '0715', '0730', '0745', '0800', '0815', '0830',
> '0845', '0900', '0915', '09
> 30', '0945', '1000', '1015', '1030', '1045', '1100', '1115', '1130',
> '1145', '1200', '1215', '1230',
>  '1245', '1300', '1315', '1330', '1345', '1400', '1415']
>
> ax.plot(t, y)
>
> I tried to convert hours and minutes to the base 100 ( , it works but I
> can not show on the x-axis the hours, minutes.
> I tried to use plot_date, but I don't understand "x and/or y can be a
> sequence of dates represented as float days since 0001-01-01 UTC."
>
> Could you help me, please ?


You don't necessarily need to use plot_date. Try this:


import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter, MultipleLocator

times = ['0015', '0030', '0045', '0100', '0115', '0130', '0145', '0200',
'0215',
'0230', '0245', '0300', '0315', '0330', '0345', '0400', '0415', '0430',
'0445', '0500', '0515', '0530', '0545', '0600', '0615', '0630', '0645',
'0700', '0715', '0730', '0745', '0800', '0815', '0830', '0845', '0900',
'0915', '0930', '0945', '1000', '1015', '1030', '1045', '1100', '1115',
'1130', '1145', '1200', '1215', '1230', '1245', '1300', '1315', '1330',
'1345', '1400', '1415']

# Conver the string time values into the corresponding number of minutes
minutes = np.array([int(t[:2])*60 + int(t[2:]) for t in times])

y = np.random.rand(*minutes.shape)
plt.plot(minutes, y)
ax = plt.gca()

# Set the formatter to take a value in minutes and convert to hour:minute
ax.xaxis.set_major_formatter(FuncFormatter(
lambda t,p : '%02d:%02d' % (t//60, t%60)))

# Set up placing tick marks every 15 minutes
ax.xaxis.set_major_locator(MultipleLocator(15))

# Used to rotate all of the ticks so that they fit on the plot.
# ha='center' aligns them better to the tick marks
fig = plt.gcf()
fig.autofmt_xdate(rotation=90, ha='center')
plt.show()


Ryan

--
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] strange issue

2009-05-07 Thread Thomas Robitaille
Hello,

I'm having a strange issue, and I've managed to reduce it to a simple  
problem. I created the following file structure:

- a directory named scripts/
- a script called scripts/inspect.py
- a script called scripts/test.py

inspect.py contains just 'pass' and test.py contains 'from  
matplotlib.pyplot import *'. When I run

python scripts/test.py

I get the traceback included below. Basically, it looks like python is  
trying to import my inspect.py script instead of one that comes with  
matplotlib. Is this just down to the design of python? Is there  
anything I can do to avoid this problem in future apart from renaming  
inspect.py to another name?

Thanks,

Thomas

Traceback (most recent call last):
   File "scripts/test.py", line 1, in 
 from matplotlib.pyplot import *
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/matplotlib-0.98.6svn-py2.6-macosx-10.5-fat.egg/ 
matplotlib/__init__.py", line 129, in 
 from rcsetup import defaultParams, validate_backend,  
validate_toolbar
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/matplotlib-0.98.6svn-py2.6-macosx-10.5-fat.egg/ 
matplotlib/rcsetup.py", line 19, in 
 from matplotlib.colors import is_color_like
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/matplotlib-0.98.6svn-py2.6-macosx-10.5-fat.egg/ 
matplotlib/colors.py", line 52, in 
 import numpy as np
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ 
numpy/__init__.py", line 147, in 
 import ma
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ 
numpy/ma/__init__.py", line 44, in 
 import core
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ 
numpy/ma/core.py", line 4855, in 
 all = _frommethod('all')
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ 
numpy/ma/core.py", line 4829, in __init__
 self.__doc__ = self.getdoc()
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ 
numpy/ma/core.py", line 4835, in getdoc
 signature = self.__name__ + get_object_signature(meth)
   File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ 
numpy/ma/core.py", line 111, in get_object_signature
 sig = inspect.formatargspec(*inspect.getargspec(obj))
AttributeError: 'module' object has no attribute 'formatargspec'


--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] strange issue

2009-05-07 Thread Sandro Tosi
On Thu, May 7, 2009 at 21:12, Thomas Robitaille
 wrote:
> Hello,
>
> I'm having a strange issue, and I've managed to reduce it to a simple
> problem. I created the following file structure:
>
> - a directory named scripts/
> - a script called scripts/inspect.py
> - a script called scripts/test.py
>
> inspect.py contains just 'pass' and test.py contains 'from
> matplotlib.pyplot import *'. When I run
>
> python scripts/test.py
>
> I get the traceback included below. Basically, it looks like python is
> trying to import my inspect.py script instead of one that comes with
> matplotlib. Is this just down to the design of python?

the current directory and the one containing the executed script are
by default imported first than standard and 3rd part modules.

> Is there
> anything I can do to avoid this problem in future apart from renaming
> inspect.py to another name?

rename it :) or maybe changing the os.path variable forcing to some values.

Cheers,
-- 
Sandro Tosi (aka morph, morpheus, matrixhasu)
My website: http://matrixhasu.altervista.org/
Me at Debian: http://wiki.debian.org/SandroTosi

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] strange issue

2009-05-07 Thread Eric Firing
Thomas Robitaille wrote:
> Hello,
> 
> I'm having a strange issue, and I've managed to reduce it to a simple  
> problem. I created the following file structure:
> 
> - a directory named scripts/
> - a script called scripts/inspect.py
> - a script called scripts/test.py
> 
> inspect.py contains just 'pass' and test.py contains 'from  
> matplotlib.pyplot import *'. When I run
> 
> python scripts/test.py
> 
> I get the traceback included below. Basically, it looks like python is  
> trying to import my inspect.py script instead of one that comes with  
> matplotlib. Is this just down to the design of python? Is there  

Actually, inspect.py doesn't come from mpl, it is in the python standard 
library.

Eric

> anything I can do to avoid this problem in future apart from renaming  
> inspect.py to another name?
> 
> Thanks,
> 
> Thomas
> 
> Traceback (most recent call last):
>File "scripts/test.py", line 1, in 
>  from matplotlib.pyplot import *
>File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
> python2.6/site-packages/matplotlib-0.98.6svn-py2.6-macosx-10.5-fat.egg/ 
> matplotlib/__init__.py", line 129, in 
>  from rcsetup import defaultParams, validate_backend,  
> validate_toolbar
>File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
> python2.6/site-packages/matplotlib-0.98.6svn-py2.6-macosx-10.5-fat.egg/ 
> matplotlib/rcsetup.py", line 19, in 
>  from matplotlib.colors import is_color_like
>File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
> python2.6/site-packages/matplotlib-0.98.6svn-py2.6-macosx-10.5-fat.egg/ 
> matplotlib/colors.py", line 52, in 
>  import numpy as np
>File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
> python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ 
> numpy/__init__.py", line 147, in 
>  import ma
>File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
> python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ 
> numpy/ma/__init__.py", line 44, in 
>  import core
>File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
> python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ 
> numpy/ma/core.py", line 4855, in 
>  all = _frommethod('all')
>File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
> python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ 
> numpy/ma/core.py", line 4829, in __init__
>  self.__doc__ = self.getdoc()
>File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
> python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ 
> numpy/ma/core.py", line 4835, in getdoc
>  signature = self.__name__ + get_object_signature(meth)
>File "/Library/Frameworks/Python.framework/Versions/2.6/lib/ 
> python2.6/site-packages/numpy-1.4.0.dev6942-py2.6-macosx-10.5-fat.egg/ 
> numpy/ma/core.py", line 111, in get_object_signature
>  sig = inspect.formatargspec(*inspect.getargspec(obj))
> AttributeError: 'module' object has no attribute 'formatargspec'
> 
> 
> --
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
> Series Scanner you'll get full speed at 300 dpi even with all image 
> processing features enabled. http://p.sf.net/sfu/kodak-com
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xlabel vertical positioning

2009-05-07 Thread Ryan May
On Tue, Apr 28, 2009 at 9:54 PM, Thomas Robitaille <
thomas.robitai...@gmail.com> wrote:

> Thanks! I could not find any documentation relating to this, so I was
> wondering whether it would be better to go with a well-documented
> function such as text or figtext? What would be best to use?
>
> Thomas
>
> On 28 Apr 2009, at 22:27, Yong-Duk Jin wrote:
>
> > You can use 'LABELPAD' to adjust label position.
> > e.g.
> >
> > import pylab
> > hAxes = pylab.axes()
> > pylab.xlabel('test')
> > hAxes.xaxis.LABELPAD = 0
> > pylab.show()
> >
>

There's now a documented way to do this in SVN HEAD, by passing labelpad as
an argument to the xlabel/ylabel functions.

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xlabel vertical positioning

2009-05-07 Thread Eric Firing
Ryan May wrote:
> On Tue, Apr 28, 2009 at 9:54 PM, Thomas Robitaille 
> mailto:thomas.robitai...@gmail.com>> wrote:
> 
> Thanks! I could not find any documentation relating to this, so I was
> wondering whether it would be better to go with a well-documented
> function such as text or figtext? What would be best to use?
> 
> Thomas
> 
> On 28 Apr 2009, at 22:27, Yong-Duk Jin wrote:
> 
>  > You can use 'LABELPAD' to adjust label position.
>  > e.g.
>  >
>  > import pylab
>  > hAxes = pylab.axes()
>  > pylab.xlabel('test')
>  > hAxes.xaxis.LABELPAD = 0
>  > pylab.show()
>  >
> 
> 
> There's now a documented way to do this in SVN HEAD, by passing labelpad 
> as an argument to the xlabel/ylabel functions.

Ryan,

Good idea, thanks.

Quick thought, with no investigation on my part: wouldn't it be more 
natural and more useful if text placement pads like this were in 
font-size units, like the "em" and "ex", so that they would scale with 
the font size?  I think that this would make the need to set them 
manually much less common.

Eric

> 
> Ryan
> 
> -- 
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
> Sent from Norman, Oklahoma, United States
> 
> 
> 
> 
> --
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
> Series Scanner you'll get full speed at 300 dpi even with all image 
> processing features enabled. http://p.sf.net/sfu/kodak-com
> 
> 
> 
> 
> ___
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xlabel vertical positioning

2009-05-07 Thread Ryan May
On Thu, May 7, 2009 at 3:13 PM, Eric Firing  wrote:

> Ryan May wrote:
>
>> On Tue, Apr 28, 2009 at 9:54 PM, Thomas Robitaille <
>> thomas.robitai...@gmail.com > wrote:
>>
>>Thanks! I could not find any documentation relating to this, so I was
>>wondering whether it would be better to go with a well-documented
>>function such as text or figtext? What would be best to use?
>>
>>Thomas
>>
>>On 28 Apr 2009, at 22:27, Yong-Duk Jin wrote:
>>
>> > You can use 'LABELPAD' to adjust label position.
>> > e.g.
>> >
>> > import pylab
>> > hAxes = pylab.axes()
>> > pylab.xlabel('test')
>> > hAxes.xaxis.LABELPAD = 0
>> > pylab.show()
>> >
>>
>>
>> There's now a documented way to do this in SVN HEAD, by passing labelpad
>> as an argument to the xlabel/ylabel functions.
>>
>
> Ryan,
>
> Good idea, thanks.
>
> Quick thought, with no investigation on my part: wouldn't it be more
> natural and more useful if text placement pads like this were in font-size
> units, like the "em" and "ex", so that they would scale with the font size?
>  I think that this would make the need to set them manually much less
> common.
>
>
Good idea, I agree that might help. I was just going for somewhat of a quick
hack, by just cleaning up access to a pre-existing constant.  Right now it
adds this pad value scaled by dpi/72.0 to an appropriate start in pixels.
Any idea how the math could include a font size?

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma
Sent from Norman, Oklahoma, United States
--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xlabel vertical positioning

2009-05-07 Thread Eric Firing
Ryan May wrote:
> On Thu, May 7, 2009 at 3:13 PM, Eric Firing  > wrote:
> 
> Ryan May wrote:
> 
> On Tue, Apr 28, 2009 at 9:54 PM, Thomas Robitaille
>  
>  >> wrote:
> 
>Thanks! I could not find any documentation relating to this,
> so I was
>wondering whether it would be better to go with a well-documented
>function such as text or figtext? What would be best to use?
> 
>Thomas
> 
>On 28 Apr 2009, at 22:27, Yong-Duk Jin wrote:
> 
> > You can use 'LABELPAD' to adjust label position.
> > e.g.
> >
> > import pylab
> > hAxes = pylab.axes()
> > pylab.xlabel('test')
> > hAxes.xaxis.LABELPAD = 0
> > pylab.show()
> >
> 
> 
> There's now a documented way to do this in SVN HEAD, by passing
> labelpad as an argument to the xlabel/ylabel functions.
> 
> 
> Ryan,
> 
> Good idea, thanks.
> 
> Quick thought, with no investigation on my part: wouldn't it be more
> natural and more useful if text placement pads like this were in
> font-size units, like the "em" and "ex", so that they would scale
> with the font size?  I think that this would make the need to set
> them manually much less common.
> 
> 
> Good idea, I agree that might help. I was just going for somewhat of a 
> quick hack, by just cleaning up access to a pre-existing constant.  
> Right now it adds this pad value scaled by dpi/72.0 to an appropriate 
> start in pixels.  Any idea how the math could include a font size?

In any case where the text object exists at the time the calculation is 
needed, and the method doing the calculation has access to that object, 
it is just a matter of changing, for example,

 self.label.set_position( (x, bottom - 
self.labelpad*self.figure.dpi / 72.0))

to

 pad = (self.labelpad_rel * self.label.get_size() * 
self.figure.dpi / 72.0)
 self.label.set_position( (x, bottom - pad))

I think that most of the pads used in mpl are associated with text 
objects in such a way that this can be done.  The question then becomes 
one of how to implement it in a way that doesn't wreck existing code, 
and doesn't create intolerable clutter.  If this can be done, I think it 
would make a *significant* improvement in mpl usability--at least for 
anyone who needs to rescale plots for publication or for presentation 
display, for example.

Another thing to watch out for in trying to make such a change: the pad 
calculation would need to be done late enough to reflect the font size 
at draw-time.  I have not looked to see whether this is already the 
case, or whether it would require substantial refactoring.

I was not suggesting that your labelpad patch should be changed right 
away, but rather using it as an opportunity to raise the larger design 
question, and see whether anyone is interested in pursuing it.

I have raised questions about pad units before, and in fact we now have 
legend.borderpad (in legend font units) that replaces legend.pad (in 
normalized axes units).

Eric


> 
> Ryan
> 
> -- 
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
> Sent from Norman, Oklahoma, United States


--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Continuously varying line colors?

2009-05-07 Thread Erik Tollerud
Ah, I see... well, that's doable although not necessarily ideal.
Thanks to you both!

On Mon, May 4, 2009 at 10:24 AM, Ryan May  wrote:
> On Mon, May 4, 2009 at 2:22 AM, Erik Tollerud 
> wrote:
>>
>> I'm hoping to generate a line plot where the color of each pixel on
>> the plot is given by linearly interpolating the colormap from each
>> point specified in the line, instead of having the whole line be a
>> solid color.  I can "mock this up" by doing a scatter plot where the
>> points are much closer together than the screen resolution, but that
>> seems inelegant, and sometimes produces weird output.  So is there a
>> way to do effectively the same thing with a line plot or somehow
>> specify this behavior in scatter?
>
> IIRC, the backends that matplotlib uses (Gtk, Agg, etc.) only support a
> single color per line, so breaking up the line into different
> segments/points is really your only option.  Instead of scatter, you can
> break up your line into separate sections and have them colormapped for you,
> using a LineCollection.
>
> Ryan
>
> --
> Ryan May
> Graduate Research Assistant
> School of Meteorology
> University of Oklahoma
> Sent from Norman, Oklahoma, United States



-- 
Erik Tollerud
Graduate Student
Center For Cosmology
Department of Physics and Astronomy
2142 Frederick Reines Hall
University of California, Irvine
Office Phone: (949)824-2587
Cell: (651)307-9409
etoll...@uci.edu

--
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users