Re: [Matplotlib-users] matshow?

2007-03-18 Thread Suresh Pillai
On Sun, 18 Mar 2007, Eric Firing wrote:

> One of the matshow anomalies is that it is a pylab function only instead
> of a wrapper for an Axes method, so I made a new Axes.matshow(), and a
> temporary matshow1() pylab function that calls it.  Differences between
> matshow() and matshow1():
>
> 1) The latter labels the *centers* of the squares representing the
> matrix elements, starting from zero.  Tick values are consequently integers.
>
> 2) matshow1 uses the same function as matshow (figaspect()) to determine
> the window dimensions, but keeps the matrix elements square when they
> would be stretched in matshow.  I can change this back to the matshow
> behavior if desired.

You may recall from our previous discussions that I would rather you not 
change (2) back to matshow behaviour.  Although I am not sure if you say 
you will force the aspect ratio to be equal, or that you will preserve the 
aspect ratio of the matrix as specified?  (As you may recall, I was 
unhappy with the matrix being stretched when other elements were added to 
the figure.)

And thanks for #1.

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matshow?

2007-03-18 Thread Eric Firing
Fernando Perez wrote:
[...]
> Frankly, I don't care how it's done: I wrote matshow long ago, back
> when axis('scaled') didn't exist in the first place.  If the same
> result can be achieved by other means that are cleaner, I'm sure John
> will accept a patch.

One of the matshow anomalies is that it is a pylab function only instead 
of a wrapper for an Axes method, so I made a new Axes.matshow(), and a 
temporary matshow1() pylab function that calls it.  Differences between 
matshow() and matshow1():

1) The latter labels the *centers* of the squares representing the 
matrix elements, starting from zero.  Tick values are consequently integers.

2) matshow1 uses the same function as matshow (figaspect()) to determine 
the window dimensions, but keeps the matrix elements square when they 
would be stretched in matshow.  I can change this back to the matshow 
behavior if desired.

> 
> All I need regularly in my work is the ability to plot a matrix such
> that both the axis AND the enclosing figure (which determines the size
> of the resulting EPS files for publications or talks) have the aspect
> ratio of the actual matrix.  How that result is achieved is really
> immaterial to me.

I suspect that what you would actually prefer is better automated figure 
sizing so that it would always nicely enclose the axes with their 
labels, titles, etc., correct?  There is nothing magic about having the 
actual aspect ratio of the figure exactly match that of the axes box?
(Not that I can easily achieve the nice wrapping result--this is just to 
clarify the ideal.)

> 
> matshow does what I need so I use it, but I have no particular
> attachment to the code other than the fact that it happens to work
> correctly.  That's a bonus in my book.

Absolutely!

Another anomaly of matshow (presently preserved in matshow1) is the 
returnall kwarg; this seems like the sort of thing that should either be 
supported by all pylab functions, or by none.  The argument for none is 
that one can easily use gcf() and gca() to get the other two arguments. 
  Do you want to keep the returnall kwarg?

Eric

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] PDF Backend problem still unresolved

2007-03-18 Thread kc106_2005-matplotlib
Thanks for the reply, Jouni.

I am running Python 2.3 on Windows XP, latest version of MPL.

I'll see if I can reproduce the problem using standard examples.



Regards,

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Jouni K Seppänen
> Sent: Saturday, March 17, 2007 1:06 PM
> To: matplotlib-users@lists.sourceforge.net
> Subject: Re: [Matplotlib-users] PDF Backend problem still unresolved
> 
> 
>  <[EMAIL PROTECTED]> writes:
> 
> > > Starting with the 9th page, MPL chokes at line 1084 in 
> > > backend_pdf.py
> > Jouni posted a couple of responses witih suggestions in CVS 
> syntax but 
> > I was unable to use that information.
> 
> I had to take my laptop to be to be repaired, so I can't do 
> much work on Matplotlib right now. In the meantime, please 
> post some more information: what version of Python and 
> Matplotlib is this, on which platform, can you reduce your 
> code to a small example that exhibits the bug, what output do 
> you get with "verbose.level: debug"?
> 
> --
> Jouni
> 
> 
> 
> --
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the 
> chance to share your opinions on IT & business topics through 
> brief surveys-and earn cash 
> http://www.techsay.com/default.php?page=join.php&p=sourceforge
&CID=DEVDEV
___
Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

 
--
John Henry



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] clearing a figure

2007-03-18 Thread Fernando Perez
On 1/11/07, belinda thom <[EMAIL PROTECTED]> wrote:
> Hi,
>
> > With the exception of ipython -pylab, noone is forcing you to import
> > *.  And on the subject, Fernando, perhaps we should support a pylab
> > mode in ipython which doesn't dump the pylab namespace (or maybe just
> > dumps the required figure, show, close, nx), but does the interactive
> > backend stuff.
>
> In the meantime, I did the following to my local dev copy of IPython:
> Instead of the existing "import..." viq exec into user namespace, I do:
> import pylab as P
> import numpy as N
> import matplotlib as M
>
> It would be nice if controlling this type of thing was configurable.

It now is: set

pylab_import_all 0

in your ~/.ipython/ipythonrc file, and when using -pylab, ipython will
only import the names 'matplotlib' and 'pylab', but it will NOT do

from pylab import *

anymore.

Cheers,


f

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Ipython and python2.5

2007-03-18 Thread Fernando Perez
On 1/26/07, Fernando Perez <[EMAIL PROTECTED]> wrote:
> On 1/25/07, Alan G Isaac <[EMAIL PROTECTED]> wrote:
> > On Wed, 24 Jan 2007, Fernando Perez apparently wrote:
> > > Let us know if this is not enough or if you have any other issues.
> >
> > How about for Windows users?  You list as dependencies:

[...]

> We obviously need to update the windows documentation...

Done in SVN, thanks for reporting this.

regards,

f

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] cumulative distribution function

2007-03-18 Thread Simson Garfinkel

On Mar 18, 2007, at 12:41 PM, John Hunter wrote:

> On 3/17/07, Simson Garfinkel <[EMAIL PROTECTED]> wrote:
>> Hi. I haven't been active for a while, but now I have another paper
>> that I need to get out...
>
> Glad to have you back...

Thanks.  I've taken a new job, moved to california, and have been  
flying between the two coasts every week. It doesn't leave much time  
for mailing lists...

>
>> Anyway, I need to draw a cumulative distribution function, as the
>> reviewers of my last paper really nailed me to the wall for including
>> histograms instead of CDFs. Is there any way to plot a CDF with
>> matplotlib?
>
> For analytic cdfs, see scipy.stats.  I assume you need an empirical
> cdf.  You can use matplotlib.mlab.hist to compute the empirical pdf
> (use normed=True to return a PDF rather than a frequency count).  Then
> use numpy.cumsum to do the cumulative sum of the pdf, multiplying by
> the binsize so it approximates the integral.
>
> import matplotlib.mlab
> from pylab import figure, show, nx
>
> x = nx.mlab.randn(1)
> p,bins = matplotlib.mlab.hist(x, 50, normed=True)
> db = bins[1]-bins[0]
> cdf = nx.cumsum(p*db)
>
> fig = figure()
> ax = fig.add_subplot(111)
> ax.bar(bins, cdf, width=0.8*db)
> show()
>

Thanks! I'll try it out and see what happens.


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] xticklabels question

2007-03-18 Thread John Hunter
On 3/18/07, Allan Noriel Estrella <[EMAIL PROTECTED]> wrote:
> I have an array of data that were sampled with a sampling rate of 1.5625
> samples/sec . I want to plot these data with the x axis showing time in
> terms of hours for the major ticks and minutes for the minor ticks in my
> custom made wx App. I have been fiddling around with the HourLocator and
> MinuteLocator classes but it seems I can't get them to work. Do you know an
> easy way to do this? I just want to plot my data in terms of the actual
> time/duration of logging they represent (in hours and/or in minutes when the
> plot is zoomed in or there is less than an hour's worth of samples)

Well, the HourLocator, MiinuteLocator, etc are for times and not
durations.  If you want durations, just use plot and not plot_date.
Does that help?

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] cumulative distribution function

2007-03-18 Thread John Hunter
On 3/17/07, Simson Garfinkel <[EMAIL PROTECTED]> wrote:
> Hi. I haven't been active for a while, but now I have another paper
> that I need to get out...

Glad to have you back...

> Anyway, I need to draw a cumulative distribution function, as the
> reviewers of my last paper really nailed me to the wall for including
> histograms instead of CDFs. Is there any way to plot a CDF with
> matplotlib?

For analytic cdfs, see scipy.stats.  I assume you need an empirical
cdf.  You can use matplotlib.mlab.hist to compute the empirical pdf
(use normed=True to return a PDF rather than a frequency count).  Then
use numpy.cumsum to do the cumulative sum of the pdf, multiplying by
the binsize so it approximates the integral.

import matplotlib.mlab
from pylab import figure, show, nx

x = nx.mlab.randn(1)
p,bins = matplotlib.mlab.hist(x, 50, normed=True)
db = bins[1]-bins[0]
cdf = nx.cumsum(p*db)

fig = figure()
ax = fig.add_subplot(111)
ax.bar(bins, cdf, width=0.8*db)
show()

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] xticklabels question

2007-03-18 Thread Allan Noriel Estrella

I have an array of data that were sampled with a sampling rate of
1.5625samples/sec . I want to plot these data with the x axis showing
time in
terms of hours for the major ticks and minutes for the minor ticks in my
custom made wx App. I have been fiddling around with the HourLocator and
MinuteLocator classes but it seems I can't get them to work. Do you know an
easy way to do this? I just want to plot my data in terms of the actual
time/duration of logging they represent (in hours and/or in minutes when the
plot is zoomed in or there is less than an hour's worth of samples)
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Legend Bug in Pie chart with shadow=True

2007-03-18 Thread Michael
1.please compare figure 1 and figure 2

2 How to change text color on Pie chart ?
(If fragment of Pie chart is black text is unreadable )

3. Text "0.5%" in figure 2 is unreadable, how correct this?
( i try use pctdistance= 1.1 but if value is format autopct='%1.4f%%' 
some text is unreadable )


#!/usr/bin/env python

from pylab import *

# make a square figure and axes
figure(1, figsize=(8,8))
ax = axes([0.1, 0.1, 0.8, 0.8])

labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
fracs = [50,25,24.5, 0.5]

figure(1)
pie(fracs, labels=labels)
legend( loc='best', shadow=True)

# figure(2) show a some optional features.  autopct is used to label
# the percentage of the pie, and can be a format string or a function
# which takes a percentage and returns a string.  explode is a
# len(fracs) sequence which gives the fraction of the radius to
# offset that slice.

figure(2, figsize=(8,8))
explode=(0, 0.05, 0, 0)
pie(fracs, explode=explode, labels=labels, autopct='%1.1f%%', shadow=True)
legend( loc='best', shadow=True)
savefig('pie_demo')
show()




-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users