[Matplotlib-users] plots do not scale to size

2009-06-09 Thread Paul Anton Letnes

Dear all.

When I run the script below, the xlabel and ylabel do not show up. If  
I increase the figure size, it all works fine. If I open the file in  
Adobe Illustrator, the x and ylabels are both there, but outside the  
canvas (or bounding box or whatever it is called). I believe this must  
be a bug?


I moved my matplotlibrc file out of its usual location to make sure I  
don't have any funny settings which screws things up. I also deleted  
the tex cache to avoid any tex-related problems.


Best regards,
Paul.
##
import matplotlib
matplotlib.rcParams['figure.figsize'] = [2.85, 2.20]
matplotlib.use('pdf')
from pylab import *

xs = linspace(0, 2 * pi)
ys = sin(xs)
plot(xs, ys)
xlabel(r'$T_{est}$')
ylabel('y axis')

savefig('test')
show()





test.pdf
Description: Adobe PDF document



--
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


Re: [Matplotlib-users] plots do not scale to size

2009-06-09 Thread Chaitanya Krishna
Hi Paul,

I am not sure if it is a bug. But, it is usual that such a thing
happens when you are making small figures (like in your case).

Try adjusting the following parameters in your rc file, in particular
increase the left space.
# The figure subplot parameters.  All dimensions are fraction of the
# figure width or height
#figure.subplot.left: 0.125  # the left side of the subplots of the figure
#figure.subplot.right   : 0.9# the right side of the subplots of the figure
#figure.subplot.bottom  : 0.1# the bottom of the subplots of the figure
#figure.subplot.top : 0.9# the top of the subplots of the figure
#figure.subplot.wspace  : 0.2# the amount of width reserved for
blank space between subplots
#figure.subplot.hspace  : 0.2# the amount of height reserved for
white space between subplots

The other thing that you can try is to decrease the font size of the
axis labels.

It would be nice if we can rescale the left, right spacing depending
on the figure size.

Cheers,
Chaitanya


On Tue, Jun 9, 2009 at 12:05 PM, Paul Anton
Letnes wrote:
> Dear all.
>
> When I run the script below, the xlabel and ylabel do not show up. If I
> increase the figure size, it all works fine. If I open the file in Adobe
> Illustrator, the x and ylabels are both there, but outside the canvas (or
> bounding box or whatever it is called). I believe this must be a bug?
>
> I moved my matplotlibrc file out of its usual location to make sure I don't
> have any funny settings which screws things up. I also deleted the tex cache
> to avoid any tex-related problems.
>
> Best regards,
> Paul.
> ##
> import matplotlib
> matplotlib.rcParams['figure.figsize'] = [2.85, 2.20]
> matplotlib.use('pdf')
> from pylab import *
>
> xs = linspace(0, 2 * pi)
> ys = sin(xs)
> plot(xs, ys)
> xlabel(r'$T_{est}$')
> ylabel('y axis')
>
> savefig('test')
> show()
>
>
>
>
>
>
>
> --
> 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
>
>

--
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] plots do not scale to size

2009-06-09 Thread Paul Anton Letnes

Dear all.


When I run the script below, the xlabel and ylabel do not show up. If  
I increase the figure size, it all works fine. If I open the file in  
Adobe Illustrator, the x and ylabels are both there, but outside the  
canvas (or bounding box or whatever it is called). I believe this must  
be a bug?


I moved my matplotlibrc file out of its usual location to make sure I  
don't have any funny settings which screws things up. I also deleted  
the tex cache to avoid any tex-related problems.



Best regards,
Paul.

import matplotlib
matplotlib.rcParams['figure.figsize'] = [2.85, 2.20]
matplotlib.use('pdf')
from pylab import *

xs = linspace(0, 2 * pi)
ys = sin(xs)
plot(xs, ys)
xlabel(r'$T_{est}$')
ylabel('y axis')

savefig('test')
show()


test.pdf
Description: Adobe PDF document
--
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] Custom coordinates in navigation window

2009-06-09 Thread Nan Dun
Hello,

Currently, in navigation window, the coordinates of cursor show like
x = "%.1f", y="%.1f"

Is it possible to custom these labels such that they show like

my_x="%.3f", my_y="%.6f"

Thank you.

Nan

--
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


Re: [Matplotlib-users] imshow axis labels

2009-06-09 Thread Michael Droettboom
You may just want to start with the "custom_ticker1.py" example here:

http://matplotlib.sourceforge.net/examples/pylab_examples/custom_ticker1.html

The meat of it is just to provide a function that converts the incoming 
values (in your case pixel positions) into whatever you want to be 
displayed.

Cheers,
Mike

Jeremy Lewi wrote:
> I want to let matplotlib control where the tick marks go, but I want 
> to scale the value of the tick labels. For example,
> if my matrix has a 100 columns the tick marks might be [0,25,50,100].  
> I want to scale these tick labels by some value say .01 so that the 
> corresponding tick labels would be [0,.25,.5,1].
>
> Now say I zoom in on the image so that the xaxis limits are (0,50). 
> Lets suppose the tick marks are now [0,10,20,30,40,50]
> Then in this case the tick labels should be
> [0,.1,.2,.3,.4,.5]
>
> So how do I go about creating a custom formatter?
>
> Thanks
> Jeremy
>
> Michael Droettboom wrote:
>> What are you setting the x ticklabels to?  If you want to control how 
>> the numbers are displayed, you can create a custom formatter (which 
>> is basically a function to convert a floating-point number to a 
>> string).  If you want to control the number of ticks across the axis, 
>> you can make a custom ticker.
>>
>> If you can describe what your end goal is, I'm happy to describe the 
>> above options in more detail.
>>
>> Cheers,
>> Mike
>>
>> Jeremy Lewi wrote:
>>  
>>> Hi,
>>> I'm using imshow to make an image of a 2-d matrix. I use 
>>> set_xticklabels to adjust the x-axis labels. The problem is that 
>>> when I then zoom in on the plot, the axis labels are not adjusted 
>>> appropriately. Does anyone suggestions on how I can fix this?
>>>
>>> Thanks
>>> Jeremy
>>>
>>> --
>>>  
>>>
>>> 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
>>>   
>>
>>   
>

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


--
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


Re: [Matplotlib-users] Custom coordinates in navigation window

2009-06-09 Thread John Hunter
On Tue, Jun 9, 2009 at 4:44 AM, Nan Dun wrote:
> Hello,
>
> Currently, in navigation window, the coordinates of cursor show like
> x = "%.1f", y="%.1f"
>
> Is it possible to custom these labels such that they show like
>
> my_x="%.3f", my_y="%.6f"


def my_x(x): return '%.3f'%x
def my_y(y): return '%.3f'%y

ax.fmt_xdata = my_x
ax.fmt_ydata = my_y

JDH

--
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] matplotlibrc customizing

2009-06-09 Thread Ulrich vor dem Esche
Greetings! I am new to matplotlib and python, and encountered a general problem:
If i try to customize matplotlibrc, nothing changes. I changed the right thing:
When i try

import matplotlib
matplotlib.matplotlib_fname()

I get 'C:\\Python25\lib\\site-packages\\matplotlib\\mpl-data\\matplotlibrc'
(as you see I'm in windows..)

When I f.e. change

#xtick.labelsize  : 14  (from '12')
#xtick.direction  : out (from 'in')

nothing changes at all. My program starts with 'import matplotlib.pyplot as 
plt', so
that actually matplotlibrc should be in use.. I tried to change other things in
\\matplotlib aswell, they were all ignored. I must have missed something very 
basic..
What did i miss?

Ulli

Text: GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de


--
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


Re: [Matplotlib-users] matplotlibrc customizing

2009-06-09 Thread John Hunter
On Tue, Jun 9, 2009 at 8:23 AM, Ulrich vor dem Esche wrote:
> Greetings! I am new to matplotlib and python, and encountered a general 
> problem:
> If i try to customize matplotlibrc, nothing changes. I changed the right 
> thing:
> When i try
>
> import matplotlib
> matplotlib.matplotlib_fname()
>
> I get 'C:\\Python25\lib\\site-packages\\matplotlib\\mpl-data\\matplotlibrc'
> (as you see I'm in windows..)
>
> When I f.e. change
>
> #xtick.labelsize  : 14  (from '12')
> #xtick.direction  : out (from 'in')
>

By default, all lines are commented out.  You must remove the leading
'#" symbol to see your changes take effect

JDH

--
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


Re: [Matplotlib-users] matplotlibrc customizing

2009-06-09 Thread Sebastian Busch
Ulrich vor dem Esche wrote:
> ...
> #xtick.labelsize  : 14  (from '12')
> #xtick.direction  : out (from 'in')
> 
> nothing changes ...
> I must have missed something very basic..

I guess that would be the "#" which declares everything behind as a comment.

Does it work when you remove the #?

Best,
Sebastian.



signature.asc
Description: OpenPGP digital signature
--
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


Re: [Matplotlib-users] plots do not scale to size

2009-06-09 Thread Jouni K . Seppänen
Chaitanya Krishna  writes:

> On Tue, Jun 9, 2009 at 12:05 PM, Paul Anton Letnes 
>  wrote:
>>
>> When I run the script below, the xlabel and ylabel do not show up. If I
>> increase the figure size, it all works fine.
>
> I am not sure if it is a bug. But, it is usual that such a thing
> happens when you are making small figures (like in your case).

Arguably it is a bug, since it is reasonable to expect that when you set
an xlabel or ylabel (or, say, large yticklabels), it shows up in the
figure. There are at least two problems to solve here: what should the
user interface be like, and how can it best be implemented?

The user interface question seems difficult to me. If you set the figure
size to something small (as in this case) and then add labels, should
matplotlib reduce the area available for the plot? Or should it reduce
the font size of the labels and the tick labels, and perhaps the amount
of white space between the axes and the labels? Or some combination of
these?

The implementation question could also be somewhat hairy, since the
bounding box of text objects depends on the backend. If agg and pdf
disagree on the size of a label, is it OK to get different-looking
results in png and pdf?

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


--
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] exporting PYTHONPATH causes matplotlib not to load

2009-06-09 Thread Hani Nakhoul
Dear all,
I'm running matplotlib 0.98.5.2 on a machine with Ubuntu Intrepid 8.10. It's
worked well for me so far, but I encounter problems running matplotlib when
trying to update the PYTHONPATH in the .bashrc file. Adding just the line
"export PYTHONPATH=$PYTHONPATH", for example, gives the following:

$ ipython -pylab
Traceback (most recent call last):
  File "/usr/bin/ipython", line 27, in 
IPython.Shell.start().mainloop()
  File "/var/lib/python-support/python2.5/IPython/Shell.py", line 1219, in
start
shell = _select_shell(sys.argv)
  File "/var/lib/python-support/python2.5/IPython/Shell.py", line 1188, in
_select_shell
backend = matplotlib.rcParams['backend']
AttributeError: 'module' object has no attribute 'rcParams'

On the other hand,

$ ipython

permits ipython to load seemingly normally, but in that case

In [1]: import matplotlib.pyplot as plt
ImportError: No module named pyplot

Any ideas on what might be wrong? I'd be grateful for any advice.

Thanks,
Hani Nakhoul
--
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


Re: [Matplotlib-users] plots do not scale to size

2009-06-09 Thread John Hunter
On Tue, Jun 9, 2009 at 10:18 AM, Jouni K. Seppänen wrote:
> Chaitanya Krishna  writes:
>
>> On Tue, Jun 9, 2009 at 12:05 PM, Paul Anton Letnes 
>>  wrote:
>>>
>>> When I run the script below, the xlabel and ylabel do not show up. If I
>>> increase the figure size, it all works fine.
>>
>> I am not sure if it is a bug. But, it is usual that such a thing
>> happens when you are making small figures (like in your case).
>
> Arguably it is a bug, since it is reasonable to expect that when you set
> an xlabel or ylabel (or, say, large yticklabels), it shows up in the
> figure. There are at least two problems to solve here: what should the
> user interface be like, and how can it best be implemented?

These FAQs are also probably relevant:

http://matplotlib.sourceforge.net/faq/howto_faq.html#move-the-edge-of-an-axes-to-make-room-for-tick-labels
http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room-for-tick-labels

JDH

--
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


Re: [Matplotlib-users] exporting PYTHONPATH causes matplotlib not to load

2009-06-09 Thread John Hunter
On Tue, Jun 9, 2009 at 10:22 AM, Hani Nakhoul wrote:
> Dear all,
> I'm running matplotlib 0.98.5.2 on a machine with Ubuntu Intrepid 8.10. It's
> worked well for me so far, but I encounter problems running matplotlib when
> trying to update the PYTHONPATH in the .bashrc file. Adding just the line
> "export PYTHONPATH=$PYTHONPATH", for example, gives the following:
>
> $ ipython -pylab
> Traceback (most recent call last):
>   File "/usr/bin/ipython", line 27, in 
> IPython.Shell.start().mainloop()
>   File "/var/lib/python-support/python2.5/IPython/Shell.py", line 1219, in
> start
> shell = _select_shell(sys.argv)
>   File "/var/lib/python-support/python2.5/IPython/Shell.py", line 1188, in
> _select_shell
> backend = matplotlib.rcParams['backend']
> AttributeError: 'module' object has no attribute 'rcParams'

Most likely you are adding a directory to the path that has a
directory named matplotlib in it (eg the matplotlib src directory)
which is not the matplotlib install directory.  Try doing

>>> import matplotlib
>>> print matplotlib.__file__

when the PYTHONPATH is set to the troublesome value and then do an ls
on the directory that is reported by the __file__ printout.  Post the
listing here and we can advise further.

JDH

--
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


Re: [Matplotlib-users] Where to post examples (specifically, one that may be useful for time-evolution plots)

2009-06-09 Thread C Lewis
>
>> I am curious though why you prefer to alter the default color cycle
>> rather than just passing the color in to the plot command
[...]
>  I got tired of the extra code involved with this method and went  
> looking for a way to change the defaults.

I do something similar to enforce style/substance separation; the  
plotting is the simplest possible line at the end of the data  
analysis, and all the stylistic choices are somewhere else. Makes it  
easy to keep all plot styles consistent during a project, and makes it  
slightly harder to futz with font prettiness when I should be doing  
real work.

Chloe Lewis
Graduate student, Amundson Lab
Division of Ecosystem Sciences, ESPM
University of California, Berkeley
137 Mulford Hall - #3114
Berkeley, CA  94720-3114
chle...@nature.berkeley.edu


--
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] autocrop function

2009-06-09 Thread Nils Wagner
Hi all,

I am looking for an autocrop function.

It should remove borders from an image.
Is it available in matplotlib ?

Any pointer would be appreciated.

Thanks in advance

Nils


  

--
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


Re: [Matplotlib-users] Beginning Python Visualization??

2009-06-09 Thread Esmail
Sebastian Busch wrote:
>
> 
> Hey Esmail,
> 
> there was the possibility for 3D plots in matplotlib:
> http://www.scipy.org/Cookbook/Matplotlib/mplot3D
> 
> however, the mayavi "mlab" interface was designed explicitly to be as
> simple as pylab.
> http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/mlab.html
> 
> have fun 3D plotting,
> sebastian.

I'll give mayavi/mlab a try, I think there was a note to the
effect that matplotlib quit supporting 3D plots and recommended
mayavi.

So much to learn, so little time :-)

Thanks,
Esmail


--
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


Re: [Matplotlib-users] Beginning Python Visualization??

2009-06-09 Thread Gökhan SEVER
On Tue, Jun 9, 2009 at 12:46 PM, Esmail  wrote:

> Sebastian Busch wrote:
> >
> >
> > Hey Esmail,
> >
> > there was the possibility for 3D plots in matplotlib:
> > http://www.scipy.org/Cookbook/Matplotlib/mplot3D
> >
> > however, the mayavi "mlab" interface was designed explicitly to be as
> > simple as pylab.
> >
> http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/mlab.html
> >
> > have fun 3D plotting,
> > sebastian.
>
> I'll give mayavi/mlab a try, I think there was a note to the
> effect that matplotlib quit supporting 3D plots and recommended
> mayavi.
>


There is still work going on to improve matplotlib 3d plotting
functionality. You can see matplotlib gallery or check-out the latest trunk
of matplotlib and experiment with the 3d examples.


>
> So much to learn, so little time :-)


Isn't that nice? Lifelong learning? Why are complaining? Are you not a
scientist or raising a kid something :)


>
>
> Thanks,
> Esmail
>
>
--
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


Re: [Matplotlib-users] Beginning Python Visualization??

2009-06-09 Thread Esmail
Hi Gökhan,


Gökhan SEVER wrote:
> 
> I'll give mayavi/mlab a try, I think there was a note to the
> effect that matplotlib quit supporting 3D plots and recommended
> mayavi.
> 
> 
> There is still work going on to improve matplotlib 3d plotting 
> functionality. You can see matplotlib gallery or check-out the latest 
> trunk of matplotlib and experiment with the 3d examples.

Ah .. ok .. good to know. I was going by this note:

NOTE: 3D plotting has been removed from matplotlib >= 0.98. You'll either need 
to use an older 0.91.x version or look at Mayavi which is actively maintained 
and features an 'mlab' interface similar to matplotlib's 'pylab'.

posted here:

http://www.scipy.org/Cookbook/Matplotlib


> So much to learn, so little time :-)
> 
> 
> Isn't that nice? Lifelong learning? Why are complaining? Are you not a 
> scientist or raising a kid something :)

hehe .. I know it sounded like a complaint, but it's really not. I
consider myself a lifelong student, and I love learning new things.
I just have a big appetite :-)

Cheers,
Esmail


--
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


Re: [Matplotlib-users] Beginning Python Visualization??

2009-06-09 Thread Gökhan SEVER
On Tue, Jun 9, 2009 at 1:00 PM, Esmail  wrote:

> Hi Gökhan,
>
>
> Gökhan SEVER wrote:
> >
> > I'll give mayavi/mlab a try, I think there was a note to the
> > effect that matplotlib quit supporting 3D plots and recommended
> > mayavi.
> >
> >
> > There is still work going on to improve matplotlib 3d plotting
> > functionality. You can see matplotlib gallery or check-out the latest
> > trunk of matplotlib and experiment with the 3d examples.
>
> Ah .. ok .. good to know. I was going by this note:
>
> NOTE: 3D plotting has been removed from matplotlib >= 0.98. You'll either
> need
> to use an older 0.91.x version or look at Mayavi which is actively
> maintained
> and features an 'mlab' interface similar to matplotlib's 'pylab'.
>
> posted here:
>
> http://www.scipy.org/Cookbook/Matplotlib
>


Modified that section as to eliminate confusions:

*NOTE:* *Experimental work has been going on to integrate 3D plotting
functionality into matplotlib*. Please see the related mplot3d
documentationor
take a look at matplotlib
gallery  for example 3D
plots. For a more sophisticated 3D visualization and plotting interface, you
can try Mayavi  which is
actively maintained and features an 'mlab' interface similar to matplotlib's
'pylab'.


>
>
> > So much to learn, so little time :-)
> >
> >
> > Isn't that nice? Lifelong learning? Why are complaining? Are you not a
> > scientist or raising a kid something :)
>
> hehe .. I know it sounded like a complaint, but it's really not. I
> consider myself a lifelong student, and I love learning new things.
> I just have a big appetite :-)
>


No matter how big an appetite you have, you can only digest certain amount
of items at a time :)
Cheers for lifelong learning :)



>
> Cheers,
> Esmail
>
>
--
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


Re: [Matplotlib-users] autocrop function

2009-06-09 Thread Anton Vasilescu
I wasn't able to find one in Matplotlib but you can use PIL library for all the 
imaging work. Really easy to use. 
Here is the webpage for it: http://www.pythonware.com/products/pil/index.htm

Anton





From: Nils Wagner 
To: matplotlib-users@lists.sourceforge.net
Sent: Tuesday, June 9, 2009 10:22:05 AM
Subject: [Matplotlib-users] autocrop function

Hi all,

I am looking for an autocrop function.

It should remove borders from an image.
Is it available in matplotlib ?

Any pointer would be appreciated.

Thanks in advance

Nils


  

--
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



  --
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


Re: [Matplotlib-users] autocrop function

2009-06-09 Thread Nils Wagner
On Tue, 9 Jun 2009 11:31:19 -0700 (PDT)
  Anton Vasilescu  wrote:
> I wasn't able to find one in Matplotlib but you can use 
>PIL library for all the imaging work. Really easy to use. 
> Here is the webpage for it: 
>http://www.pythonware.com/products/pil/index.htm
> 
> Anton
> 
> 
Hi Anton,

Thank you for your prompt reply.
I am aware of PIL.
However I didn't find an autocrop function within PIL.

Cheers,
Nils

from PIL import Image
im = Image.open('test.png')
#
# Calculates the bounding box of the non-zero regions in 
the image.
# The bounding box is returned as a 4-tuple defining
# the left, upper, right, and lower pixel coordinate.
# If the image is completely empty, this method returns 
None.
#
print im.getbbox()

print im.size
#
# Returns a rectangular region from the current image.
# The box is a 4-tuple defining the left, upper, right, 
and lower
#
box = (100, 100, 800, 800)
region = im.crop(box)
region.show()
  

It would be nice to compute the box automatically.
Any idea ?



--
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


Re: [Matplotlib-users] exporting PYTHONPATH causes matplotlib not to load

2009-06-09 Thread Hani Nakhoul
Dear all,
Here is the listing:

In [1]: import matplotlib

In [2]: print matplotlib.__file__
matplotlib/__init__.pyc

In [3]: ls -a
./   .gimp-2.6/  Public/
../   .gksu.lock  .pulse/
.adobe/.gnome2/  .pulse-cookie
ATLAS/   .gnome2_private/   pydstool/
.bash_history  .gnupg/  PyDSTool/
.bash_logout   .gstreamer-0.10/   .recently-used
.bashrc.gtk-bookmarks  .recently-used.xbel
.bashrc~   .gvfs/  scipy-0.7.0b1/
.cache/.hplip/  scipy_build/
.checkgmail/   .ICEauthority  .ssh/
.compiz/   .icons/  .subversion/
.config/   .inkscape/  .sudo_as_admin_successful
.dbus/   .ipython/  SuiteSparse/
Desktop/   lapack-3.1.1/  Templates/
.dmrc   .lftp/  .themes/
Documents/ .local/  .thumbnails/
.emacs   .macromedia/  .tomboy/
.emacs.d/  matplotlib/  .tomboy.log
.esd_auth  .matplotlib/  .tsclient/
.evolution/.mozilla/  .update-manager-core/
Examples@  .mozilla-thunderbird/  .update-notifier/
fftw-3.2/  Music/  Videos/
.fontconfig/   .nautilus/  .viminfo
.gconf/neuron/  .wapi/
.gconfd/   numpy-1.2.1/  .Xauthority
.geany/.openoffice.org2/  .xsession-errors
.gegl-0.0/ Pictures/
.gftp/   .profile


Hani


On Tue, Jun 9, 2009 at 10:30 AM, John Hunter  wrote:

> On Tue, Jun 9, 2009 at 10:22 AM, Hani Nakhoul wrote:
> > Dear all,
> > I'm running matplotlib 0.98.5.2 on a machine with Ubuntu Intrepid 8.10.
> It's
> > worked well for me so far, but I encounter problems running matplotlib
> when
> > trying to update the PYTHONPATH in the .bashrc file. Adding just the line
> > "export PYTHONPATH=$PYTHONPATH", for example, gives the following:
> >
> > $ ipython -pylab
> > Traceback (most recent call last):
> >   File "/usr/bin/ipython", line 27, in 
> > IPython.Shell.start().mainloop()
> >   File "/var/lib/python-support/python2.5/IPython/Shell.py", line 1219,
> in
> > start
> > shell = _select_shell(sys.argv)
> >   File "/var/lib/python-support/python2.5/IPython/Shell.py", line 1188,
> in
> > _select_shell
> > backend = matplotlib.rcParams['backend']
> > AttributeError: 'module' object has no attribute 'rcParams'
>
> Most likely you are adding a directory to the path that has a
> directory named matplotlib in it (eg the matplotlib src directory)
> which is not the matplotlib install directory.  Try doing
>
> >>> import matplotlib
> >>> print matplotlib.__file__
>
> when the PYTHONPATH is set to the troublesome value and then do an ls
> on the directory that is reported by the __file__ printout.  Post the
> listing here and we can advise further.
>
> JDH
>
--
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


Re: [Matplotlib-users] exporting PYTHONPATH causes matplotlib not to load

2009-06-09 Thread John Hunter
On Tue, Jun 9, 2009 at 2:13 PM, Hani Nakhoul wrote:
> Dear all,
> Here is the listing:
>
> In [1]: import matplotlib
>
> In [2]: print matplotlib.__file__
> matplotlib/__init__.pyc
>
> In [3]: ls -a
> ./       .gimp-2.6/      Public/
> ../       .gksu.lock      .pulse/
> .adobe/    .gnome2/          .pulse-cookie
> ATLAS/       .gnome2_private/   pydstool/
> .bash_history  .gnupg/          PyDSTool/
> .bash_logout   .gstreamer-0.10/   .recently-used
> .bashrc    .gtk-bookmarks      .recently-used.xbel
> .bashrc~   .gvfs/          scipy-0.7.0b1/
> .cache/    .hplip/          scipy_build/
> .checkgmail/   .ICEauthority      .ssh/
> .compiz/   .icons/          .subversion/
> .config/   .inkscape/      .sudo_as_admin_successful
> .dbus/       .ipython/      SuiteSparse/
> Desktop/   lapack-3.1.1/      Templates/
> .dmrc       .lftp/          .themes/
> Documents/ .local/          .thumbnails/
> .emacs       .macromedia/      .tomboy/
> .emacs.d/  matplotlib/      .tomboy.log
> .esd_auth  .matplotlib/      .tsclient/
> .evolution/    .mozilla/      .update-manager-core/
> examp...@  .mozilla-thunderbird/  .update-notifier/
> fftw-3.2/  Music/          Videos/
> .fontconfig/   .nautilus/      .viminfo
> .gconf/    neuron/          .wapi/
> .gconfd/   numpy-1.2.1/      .Xauthority
> .geany/    .openoffice.org2/  .xsession-errors
> .gegl-0.0/ Pictures/
> .gftp/       .profile



What I wanted was the listing of the "matplotlib" dir

> ls matplotlib

it looks like you have a matplotlib dir in your working directory that
is being picked up and you probably don't want it.

JDH
--
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


Re: [Matplotlib-users] exporting PYTHONPATH causes matplotlib not to load

2009-06-09 Thread Hani Nakhoul
I'm sorry--here's the right listing:

$ ls matplotlib
agg24  examples  KNOWN_BUGS PKG-INFOsetup.py
build  __init__.py   libREADME.txt  src
build.out  __init__.pyc  licensesetup.cfg.template  TODO
CHANGELOG  INSTALL   Makefile   setupegg.py ttconv
CXXinstall.out   MANIFEST.insetupext.py
docINTERACTIVE   matplotlibrc.template  setupext.pyc

Hani


On Tue, Jun 9, 2009 at 2:34 PM, John Hunter  wrote:

> On Tue, Jun 9, 2009 at 2:13 PM, Hani Nakhoul wrote:
> > Dear all,
> > Here is the listing:
> >
> > In [1]: import matplotlib
> >
> > In [2]: print matplotlib.__file__
> > matplotlib/__init__.pyc
> >
> > In [3]: ls -a
> > ./   .gimp-2.6/  Public/
> > ../   .gksu.lock  .pulse/
> > .adobe/.gnome2/  .pulse-cookie
> > ATLAS/   .gnome2_private/   pydstool/
> > .bash_history  .gnupg/  PyDSTool/
> > .bash_logout   .gstreamer-0.10/   .recently-used
> > .bashrc.gtk-bookmarks  .recently-used.xbel
> > .bashrc~   .gvfs/  scipy-0.7.0b1/
> > .cache/.hplip/  scipy_build/
> > .checkgmail/   .ICEauthority  .ssh/
> > .compiz/   .icons/  .subversion/
> > .config/   .inkscape/  .sudo_as_admin_successful
> > .dbus/   .ipython/  SuiteSparse/
> > Desktop/   lapack-3.1.1/  Templates/
> > .dmrc   .lftp/  .themes/
> > Documents/ .local/  .thumbnails/
> > .emacs   .macromedia/  .tomboy/
> > .emacs.d/  matplotlib/  .tomboy.log
> > .esd_auth  .matplotlib/  .tsclient/
> > .evolution/.mozilla/  .update-manager-core/
> > Examples@  .mozilla-thunderbird/  .update-notifier/
> > fftw-3.2/  Music/  Videos/
> > .fontconfig/   .nautilus/  .viminfo
> > .gconf/neuron/  .wapi/
> > .gconfd/   numpy-1.2.1/  .Xauthority
> > .geany/.openoffice.org2/  .xsession-errors
> > .gegl-0.0/ Pictures/
> > .gftp/   .profile
>
>
>
> What I wanted was the listing of the "matplotlib" dir
>
> > ls matplotlib
>
> it looks like you have a matplotlib dir in your working directory that
> is being picked up and you probably don't want it.
>
> JDH
>
--
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


Re: [Matplotlib-users] Upgrading of 3D plotting in matplotlib- recent comments on web site.

2009-06-09 Thread Lou Pecora

--- On Tue, 6/9/09, Gökhan SEVER  wrote:
> Modified that section as to eliminate confusions:

> NOTE: Experimental work has been going on to integrate 3D plotting 
>functionality into matplotlib. Please see the related mplot3d documentation or 
>take a look at matplotlib gallery for example 3D plots. For a more 
>sophisticated 3D visualization and plotting interface, you can 
>try Mayavi which is actively maintained and features an 'mlab' interface 
>similar to matplotlib's 'pylab'. 
-
It is good news that matplotlib 3D functions are being upgraded.  Thank you.
But it is unclear from the message whether one still must stay with 0.91 
version or the 3D functions in pylab now work with 0.98 and higher.  Can you 
give us some information on that?  
Thanks.

-- Lou Pecora,   my views are my own.




  --
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


Re: [Matplotlib-users] exporting PYTHONPATH causes matplotlib not to load

2009-06-09 Thread John Hunter
On Tue, Jun 9, 2009 at 2:42 PM, Hani Nakhoul wrote:
> I'm sorry--here's the right listing:
>
> $ ls matplotlib
> agg24  examples  KNOWN_BUGS PKG-INFO    setup.py
> build  __init__.py   lib    README.txt  src
> build.out  __init__.pyc  license    setup.cfg.template  TODO
> CHANGELOG  INSTALL   Makefile   setupegg.py ttconv
> CXX    install.out   MANIFEST.in    setupext.py
> doc    INTERACTIVE   matplotlibrc.template  setupext.pyc
>

es, this is your problem.  You have the matplotlib source directory in
your HOME directory and when you run from your home directory, it is
being picked up instead of the installation directory.  I usually name
my src tree "mpl" to avoid this problem


  > cd
  > mv matplotlib mpl

JDH

--
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


Re: [Matplotlib-users] Upgrading of 3D plotting in matplotlib- recent comments on web site.

2009-06-09 Thread John Hunter
On Tue, Jun 9, 2009 at 3:05 PM, Lou Pecora wrote:

> -
> It is good news that matplotlib 3D functions are being upgraded.  Thank you.
> But it is unclear from the message whether one still must stay with 0.91
> version or the 3D functions in pylab now work with 0.98 and higher.  Can you
> give us some information on that?

They now work in matplotlib svn in the toolkit mpl_toolkits.mplot3d,
and will be available in the next release

http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn

JDH

--
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


Re: [Matplotlib-users] Upgrading of 3D plotting in matplotlib- recent comments on web site.

2009-06-09 Thread Gökhan SEVER
On Tue, Jun 9, 2009 at 3:05 PM, Lou Pecora  wrote:

>
> --- On *Tue, 6/9/09, Gökhan SEVER * wrote:
> > Modified that section as to eliminate confusions:
>
> *> NOTE:* *Experimental work has been going on to integrate 3D plotting
> functionality into matplotlib. Please see the related mplot3d
> documentation
>  or
> take a look at matplotlib 
> gallery for
> example 3D plots. For a more sophisticated 3D visualization and plotting
> interface, you can try Mayavi  
> which
> is actively maintained and features an 'mlab' interface similar to
> matplotlib's 'pylab'. *
>
>
> -
>
> It is good news that matplotlib 3D functions are being upgraded.  Thank
> you.
> But it is unclear from the message whether one still must stay with 0.91
> version or the 3D functions in pylab now work with 0.98 and higher.  Can you
> give us some information on that?
>
> Thanks.
>
> -- Lou Pecora, my views are my own.
>
>
>
I have thought using the word "experimental" will make the state of mplot3d
clear :) Nevertheless, you have already been answered.

GS
--
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] MPL with PyQt: different behavior on Windows vs. Linux

2009-06-09 Thread Steve Nicholes
Hi,

I am writing some code for automated testing via GPIB using MPL and PyQt.  To 
simulate automated data collection while debugging the program, I have added a 
for loop (see below) after reading in a data file that plots each point one by 
one.  When I run the program in Linux, I see each point appear on the canvas 
one by one as designed, but when I run the same code in Windows, nothing shows 
up on the canvas during the for loop.  Instead, once the loop has completed, 
all points appear simulataneously.  Is there any reason the why calls to 
canvas.draw() show nothing when run in Windows?  I'm really lost on this one 
and would appreciate it someone can tell me what I'm doing wrong.  If you need 
more info on what I'm doing, please let me know.

Thanks in advance,

Steve

self.data = loadtxt('test_data2.csv',comments = '#',delimiter = ',',skiprows = 
0)

for i in range(0,len(self.data)):
    line, = self.plotWidget.canvas.ax.plot([self.data[i,1]], 
[self.data[i,0]], 'bo')
    self.plotWidget.canvas.draw()
  



  --
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


Re: [Matplotlib-users] MPL with PyQt: different behavior on Windows vs. Linux

2009-06-09 Thread John Hunter
On Tue, Jun 9, 2009 at 5:17 PM, Steve
Nicholes wrote:

> I am writing some code for automated testing via GPIB using MPL and PyQt.
> To simulate automated data collection while debugging the program, I have
> added a for loop (see below) after reading in a data file that plots each
> point one by one.  When I run the program in Linux, I see each point appear
> on the canvas one by one as designed, but when I run the same code in
> Windows, nothing shows up on the canvas during the for loop.  Instead, once
> the loop has completed, all points appear simulataneously.  Is there any
> reason the why calls to canvas.draw() show nothing when run in Windows?  I'm
> really lost on this one and would appreciate it someone can tell me what I'm
> doing wrong.  If you need more info on what I'm doing, please let me know.

It would help if we could see the whole program.  Ie, I assume this is
a pure qt app with no import of pyplot/pylab, but w/o seeing any code
I cannot be sure.  Also, check the qt examples at

  http://matplotlib.sourceforge.net/examples/animation/index.html

and see if they work on windows.  If so, perhaps you can borrow
inspiration from them.  If not, perhaps we need to do something
different for qt/windows animation.

JDH

JDH

--
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] axis break: a bit of a random query

2009-06-09 Thread Nicholas Stephens
Hi all,

I am still very green when it comes to the use of matplotlib but I am 
finding the versatility and robustness of the package extremely useful 
at present. One application I am constantly using matplotlib for 
concerns a break in the axis. Although I have a script or two based on 
an original from 
http://matplotlib.sourceforge.net/examples/pylab_examples/manual_axis.html 
I am curious to put something together that automates the process for my 
own purposes. In doing this I have come across the PyX 
graph.axis.split() command. I am wondering if the simple way that pyx 
makes the break could be simply relayed in matplotlib.

The question is then: has anybody tried this before? (as to be honest I 
have a few other things to do)

--
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


Re: [Matplotlib-users] autocrop function

2009-06-09 Thread Anton Vasilescu

You're right, I haven't read your question properly... I am not sure that 
autocrop exists in pil. Maybe somebody with more experience can shed some 
light.  

Sent from my iPhone

On Jun 9, 2009, at 12:10 PM, "Nils Wagner"  wrote:

On Tue, 9 Jun 2009 11:31:19 -0700 (PDT)
Anton Vasilescu  wrote:
I wasn't able to find one in Matplotlib but you can use PIL library for all the 
imaging work. Really easy to use. Here is the webpage for it: 
http://www.pythonware.com/products/pil/index.htm
Anton
Hi Anton,

Thank you for your prompt reply.
I am aware of PIL.
However I didn't find an autocrop function within PIL.

Cheers,
  Nils

from PIL import Image
im = Image.open('test.png')
#
# Calculates the bounding box of the non-zero regions in the image.
# The bounding box is returned as a 4-tuple defining
# the left, upper, right, and lower pixel coordinate.
# If the image is completely empty, this method returns None.
#
print im.getbbox()

print im.size
#
# Returns a rectangular region from the current image.
# The box is a 4-tuple defining the left, upper, right, and lower
#
box = (100, 100, 800, 800)
region = im.crop(box)
region.show()

It would be nice to compute the box automatically.
Any idea ?





  

--
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


Re: [Matplotlib-users] exporting PYTHONPATH causes matplotlib not to load

2009-06-09 Thread Jouni K . Seppänen
John Hunter  writes:

> es, this is your problem.  You have the matplotlib source directory in
> your HOME directory and when you run from your home directory, it is
> being picked up instead of the installation directory.  I usually name
> my src tree "mpl" to avoid this problem

I don't know why there is an empty __init__.py in the source directory,
but would something break if the file printed out a warning, like

print '''
  Warning: your "import %s" is picking up the matplotlib source
  directory, which is not usable as a Python module. To avoid this
  problem, either rename the directory to e.g. "mpl" or move it to
  some directory that is not on your Python path.
''' % __name__

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


--
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


Re: [Matplotlib-users] MPL with PyQt: different behavior on Windows vs. Linux

2009-06-09 Thread Steve Nicholes
Thanks John.  I hope you aren't receiving this reply twice (my email kicked me 
out when I hit send).  I actually am importing pylab so it isn't an entirely qt 
app.  I didn't post all of the code originally b/c it is long (and it would 
reveal how poor of a programmer I am :) ), but here are the relevant sections.  
The problematic section is in blue.  Please let me know if you need anything 
else.

I will try the examples you suggested the next time on I'm a Windows box to see 
if they behave differently than in Linux.  

Thanks!

#!/usr/bin/env python

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from pylab import *
from pulse_ui import Ui_MainWindow
from mpl_pyqt4_widget import MPL_Widget

class Plot_Widget(QMainWindow,  Ui_MainWindow):
   
    def __init__(self, parent = None):
    QMainWindow.__init__(self)
    self.setupUi(self)
    self.label_checkmark.hide()
    self.usr_click = 1
    self.abort_run = 0
    self.R = 
1.6e-19/(6.626e-34*3e8/(float(self.lineEdit_wavelength.text())*10**-9))
    self.facet_fraction = 0.5
    self.lengths = []
    self.etads = []
    self.data = loadtxt('test_data.csv',comments = '#',delimiter = 
',',skiprows = 0)
    self.slider_stop.setMaximum(len(self.data))
    QObject.connect(self.plotBtn, SIGNAL("clicked()"),self.plotData)
    QObject.connect(self.pushButton_abort,SIGNAL('clicked()'),self.abort)

    def abort(self):
    self.abort_run = 1
   
    def plotSetupMain(self):
    self.plotWidget.canvas.ax.cla()
    self.plotWidget.canvas.ax.set_title("Pulsed LIV")
    self.plotWidget.canvas.ax.title.set_fontsize(10)
    self.plotWidget.canvas.ax.set_xlabel("Current (mA)", fontsize = 9)
    self.plotWidget.canvas.ax.set_ylabel("Light (mW)", fontsize = 9)
    labels_x = self.plotWidget.canvas.ax.get_xticklabels()
    labels_y = self.plotWidget.canvas.ax.get_yticklabels()
    for xlabel in labels_x:
    xlabel.set_fontsize(8)
    for ylabel in labels_y:
    ylabel.set_fontsize(8)
    ylabel.set_color('b')
    self.plotWidget.canvas.ax.grid()
   
    def plotData(self):
    self.plotSetupMain()
    self.label_checkmark.hide()
    del self.plotWidget.canvas.ax.lines[:]
  
    for i in range(0,len(self.data)):
    line, = self.plotWidget.canvas.ax.plot([self.data[i,1]], 
[self.data[i,0]], 'bo')
    self.plotWidget.canvas.draw()
 
    if self.abort_run == 1:
    break
   
    if self.abort_run == 0:
    self.plotWidget.canvas.ax.plot(self.data[:,1], self.data[:,0], 'bo')
    self.usr_click = 0
    self.slider_start.setValue(len(self.data)/2)
    self.usr_click = 0
    self.slider_stop.setValue(len(self.data))
    a,b = 
polyfit(self.data[self.slider_start.value():self.slider_stop.value(),1],self.data[self.slider_start.value():self.slider_stop.value(),0+self.acquire],1)
    fit = a*self.data[:,1] + b
    self.plotWidget.canvas.ax.plot(self.data[:,1], fit, 'g-',linewidth 
= '2')
    
self.plotWidget.canvas.ax.axvline(self.data[self.slider_start.value()-1,1],linestyle
 = '--',color = 'r')
    
self.plotWidget.canvas.ax.axvline(self.data[self.slider_stop.value()-1,1],linestyle
 = '--',color = 'k')
    self.plotWidget.canvas.draw()
    self.label_etad.setText('%.3f' % (a*self.R/self.facet_fraction))
    self.label_ith.setText('%.3f' % (-b/a) + ' mA')
   
    else:
    self.abort_run = 0

--- On Tue, 6/9/09, John Hunter  wrote:

From: John Hunter 
Subject: Re: [Matplotlib-users] MPL with PyQt: different behavior on Windows  
vs. Linux
To: "Steve Nicholes" 
Cc: matplotlib-users@lists.sourceforge.net
Date: Tuesday, June 9, 2009, 6:25 PM

On Tue, Jun 9, 2009 at 5:17 PM, Steve
Nicholes wrote:

> I am writing some code for automated testing via GPIB using MPL and PyQt.
> To simulate automated data collection while debugging the program, I have
> added a for loop (see below) after reading in a data file that plots each
> point one by one.  When I run the program in Linux, I see each point appear
> on the canvas one by one as designed, but when I run the same code in
> Windows, nothing shows up on the canvas during the for loop.  Instead, once
> the loop has completed, all points appear simulataneously.  Is there any
> reason the why calls to canvas.draw() show nothing when run in Windows?  I'm
> really lost on this one and would appreciate it someone can tell me what I'm
> doing wrong.  If you need more info on what I'm doing, please let me know.

It would help if we could see the whole program.  Ie, I assume this is
a pure qt app with no import of pyplot/pylab, but w/o seeing any code
I cannot be sure.  Also, check the qt examples at

  http://matplotlib.sourceforge.net/examples/animation/index.html

and see if they work on windows.  If so, perhaps you can borrow

Re: [Matplotlib-users] autocrop function

2009-06-09 Thread Jae-Joon Lee
If you're using very recent version of mpl, you may try savefig with
"bbox_inches" option.

savefig("a.png", bbox_inches="tight")

The algorithm is not perfect, but will work for most of simple plots.

Regards,

-JJ


On Tue, Jun 9, 2009 at 1:22 PM, Nils Wagner wrote:
> Hi all,
>
> I am looking for an autocrop function.
>
> It should remove borders from an image.
> Is it available in matplotlib ?
>
> Any pointer would be appreciated.
>
> Thanks in advance
>
>                                                Nils
>
>
>
>
> --
> 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
>

--
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