Re: [Matplotlib-users] Histogram align 'edge' or 'center' bug?

2007-04-10 Thread David Fokkema
On Sun, 2007-04-08 at 19:25 +0200, David Fokkema wrote:
 On Fri, 2007-04-06 at 18:32 +0300, Jouni K. Seppänen wrote:
  David Fokkema [EMAIL PROTECTED] writes:
  
   If I choose center, the result is that my histogram is calculated
   for edge values but the bars are placed at center values which is
   completely misleading and wrong! I'd say this is a bug, but I may be
   overlooking something here...
  
  Looks like a bug to me. Could you file it at
  http://sf.net/tracker/?group_id=80706atid=560720
  so it isn't forgotten?
 
 Well... It couldn't be too hard to fix, I guess... I know python, I
 tracked down the source, I could try and fix it, right? I think I'll
 have the time next Tuesday, so hopefully I'll file a bug report with an
 attached patch, ;-)

I fixed the bug, I think. At least it's working on my system and I think
it is not invasive. Comments please? I'll send it upstream otherwise...

--- matplotlib/axes.py.orig 2007-04-10 10:58:30.0 +0200
+++ matplotlib/axes.py  2007-04-10 11:14:56.0 +0200
@@ -4149,7 +4149,7 @@
 hist bars
 
 if not self._hold: self.cla()
-n, bins = matplotlib.mlab.hist(x, bins, normed)
+n, bins = matplotlib.mlab.hist(x, bins, normed, align)
 if width is None: width = 0.9*(bins[1]-bins[0])
 if orientation == 'horizontal':
 patches = self.barh(bins, n, height=width, left=bottom,
align=align)
--- matplotlib/mlab.py.orig 2007-04-10 11:16:23.0 +0200
+++ matplotlib/mlab.py  2007-04-10 11:24:48.0 +0200
@@ -597,7 +597,7 @@
#S = -1.0*asum(p*log(p))
return S
 
-def hist(y, bins=10, normed=0):
+def hist(y, bins=10, normed=0, align='edge'):
 
 Return the histogram of y with bins equally sized bins.  If bins
 is an array, use the bins.  Return value is
@@ -626,11 +626,16 @@
 dy = (ymax-ymin)/bins 
 bins = ymin + dy*arange(bins)
 
+if align == 'center':
+   hw = .5*(bins[1]-bins[0])
+   nbins = [x-hw for x in bins]
+else:
+   nbins = bins
 
-n = searchsorted(sort(y), bins)
+n = searchsorted(sort(y), nbins)
 n = diff(concatenate([n, [len(y)]]))
 if normed:
-   db = bins[1]-bins[0]
+   db = nbins[1]-nbins[0]
return 1/(len(y)*db)*n, bins
 else:
return n, bins


Thanks,

David


-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Reuse or clone axes / figure / ??? from basemap for time series plot

2007-04-10 Thread Simon Kammerer
John Hunter schrieb:
 On 4/4/07, Simon Kammerer [EMAIL PROTECTED] wrote:
 Hi list,

 I guess it's not limited to the basemap toolkit, but it fits to explain
 my problem:

 I'd like to produce time series with basemap. As drawing coastlines,
 countrys etc. is expensive, but stays the same for every time step, I'd
 like to draw the basemap background only once and the reuse I.
 
 This can probably be solved with the copy/blit/animate stuff described
 at the end of
 http://www.scipy.org/Cookbook/Matplotlib/Animations

Doesn't work for me, as I don't want to use a GUI but save my plots as 
images.

blit() raises an error:
AttributeError: 'FigureCanvasGTKAgg' object has no attribute '_pixmap'

Probably because the FigureCanvasGTK part of FigureCanvasGTKAgg is not 
initialized?!

I guess I need blit() implemented in FigureCanvasAgg, but to my 
understanding of the animation/blitting stuff, this is probably not how 
  lowlevel figurecanvas like FigureCanvasAgg work, as they are vector 
based.

I solved my initial problem with a kind of very simple coastlines-cache 
in the basemap toolkit. I will discuss my changes with Jeff Whitaker, 
maybe they will find their way into basemap eventually...

Simon


-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Translating ticks a la MultipleLocator ?

2007-04-10 Thread Iyer
I think this is a trivial question..

If there are a set of data points being plotted in a
subplot, say 0 to 1000 points; the subplot displays
the ticks as 0 to 1000 points and it is desired to
translate those points to 0 t0 250 points on the
subplot display - with point 0 mapping to point 0,
point 250 mapping to point 2 and so on, what could be
the best way to do this ? 

Just curious,
thanks,
iyer






   

Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/

-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Translating ticks a la MultipleLocator ?

2007-04-10 Thread Antonio Gonzalez
Not sure if I understand, but I think this is what you want to do:

y = rand(1000) # your 1000 random points
x = linspace(0, 250, y.size)
plot(x,y)

/A


Iyer wrote:
 I think this is a trivial question..
 
 If there are a set of data points being plotted in a
 subplot, say 0 to 1000 points; the subplot displays
 the ticks as 0 to 1000 points and it is desired to
 translate those points to 0 t0 250 points on the
 subplot display - with point 0 mapping to point 0,
 point 250 mapping to point 2 and so on, what could be
 the best way to do this ? 
 
 Just curious,
 thanks,
 iyer
 
 
 
 
 
 

 
 Never miss an email again!
 Yahoo! Toolbar alerts you the instant new Mail arrives.
 http://tools.search.yahoo.com/toolbar/features/mail/
 
 -
 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.phpp=sourceforgeCID=DEVDEV
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Histogram align 'edge' or 'center' bug?

2007-04-10 Thread Jouni K . Seppänen
David Fokkema [EMAIL PROTECTED] writes:

 I fixed the bug, I think. At least it's working on my system and I think
 it is not invasive. Comments please? I'll send it upstream otherwise...

Does this handle the case where the user has specified bins of
different widths? It looks like you are only using the width of the
first bin:

 +if align == 'center':
 +   hw = .5*(bins[1]-bins[0])
 +   nbins = [x-hw for x in bins]
 +else:
 +   nbins = bins

At least, I've always thought that unequal bins are allowed, but from
the following it seems that the probability density support also makes
an incompatible assumption:

  if normed:
 -   db = bins[1]-bins[0]
 +   db = nbins[1]-nbins[0]
 return 1/(len(y)*db)*n, bins

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


-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Translating ticks a la MultipleLocator ?

2007-04-10 Thread Iyer
Thanx for the response..

I'd like to avoid the pylab interface... 

linspace is good.

assume you have 1000 points of data and you'd like the
ticks to display from 0 to 4, since the 1000 points of
data were sampled at 250 Hz.  

any non-pylab ideas ? Indexlocator?

-iyer

--- Antonio Gonzalez [EMAIL PROTECTED] wrote:

 Not sure if I understand, but I think this is what
 you want to do:
 
 y = rand(1000) # your 1000 random points
 x = linspace(0, 250, y.size)
 plot(x,y)
 
 /A
 
 
 Iyer wrote:
  I think this is a trivial question..
  
  If there are a set of data points being plotted in
 a
  subplot, say 0 to 1000 points; the subplot
 displays
  the ticks as 0 to 1000 points and it is desired to
  translate those points to 0 t0 250 points on the
  subplot display - with point 0 mapping to point 0,
  point 250 mapping to point 2 and so on, what could
 be
  the best way to do this ? 
  
  Just curious,
  thanks,
  iyer
  
  
  
  
  
  
 
 


  Never miss an email again!
  Yahoo! Toolbar alerts you the instant new Mail
 arrives.
 
 http://tools.search.yahoo.com/toolbar/features/mail/
  
 

-
  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.phpp=sourceforgeCID=DEVDEV
  ___
  Matplotlib-users mailing list
  Matplotlib-users@lists.sourceforge.net
 

https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 



   

Sucker-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html

-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Histogram align 'edge' or 'center' bug?

2007-04-10 Thread David Fokkema
On Tue, 2007-04-10 at 16:13 +0300, Jouni K. Seppänen wrote:
 David Fokkema [EMAIL PROTECTED] writes:
 
  I fixed the bug, I think. At least it's working on my system and I think
  it is not invasive. Comments please? I'll send it upstream otherwise...
 
 Does this handle the case where the user has specified bins of
 different widths? It looks like you are only using the width of the
 first bin:
 
  +if align == 'center':
  +   hw = .5*(bins[1]-bins[0])
  +   nbins = [x-hw for x in bins]
  +else:
  +   nbins = bins

I am only using the first width, indeed. If different widths are allowed
(and why not?) some more coding has to be done. On the other hand, I use
align = 'center' because I have a detector which samples timing
information at 20 ns intervals. So, when binning timing information, I
only have 0, 20 ns, 40 ns, 60 ns and so forth. Being able to specify
those values as the center of my bin instead of calculating edges myself
(-10, 10, 30, 50, etc.) is very useful. I can't think of an application
where you have bins of different widths and you want to center the
values... Furthermore, when plotting the histogram, the function
calculates the width of the bars only for the first bin and uses that
for all bars. So I think this function is highly unstable when you use
variable sized bins. Matplotlib.mlab.hist only calculates the histogram
and can only use variable sized bins when you want a simple histogram.
Maybe add something to this effect in the docstring?

 
 At least, I've always thought that unequal bins are allowed, but from
 the following it seems that the probability density support also makes
 an incompatible assumption:
 
   if normed:
  -   db = bins[1]-bins[0]
  +   db = nbins[1]-nbins[0]
  return 1/(len(y)*db)*n, bins
 

It does...

David


-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Translating ticks a la MultipleLocator ?

2007-04-10 Thread Iyer
I apologize if I haven't been sufficiently clear.

While your suggestion picks out the samples from the
sample set, and discards other samples - what I was
looking at --

when I plot a sample set, of say - 1000 points, the
xticks shows up as 0 to 1000 points on the plot.

I was wondering if there could be a way to translate
the xtick display to that of seconds, if the sampling
frequency is 250 Hz, the plot would still display the
original data set, but with different xticks -- for
e.g. it would display xticks as 0 to 4 seconds rather
than 0 to 1000 points.. hence is there a good way to
translate ticks ?

-iyer


--- John Hunter [EMAIL PROTECTED] wrote:

 On 4/10/07, Iyer [EMAIL PROTECTED] wrote:
  I'd like to avoid the pylab interface...
  linspace is good.
 
 from matplotlib.mlab import linspace
 
 But linspace may not be what you want.  Probably
 better:
 
 In [1]: Fs = 4.  # sampling at 4Hz
 
 In [2]: dt = 1./Fs
 
 In [3]: import numpy
 
 In [4]: ind = numpy.arange(1000.)  # the sample
 number
 
 In [5]: t = ind*dt   # the sample times
 
 In [6]: t[0]
 Out[6]: 0.0
 
 In [7]: t[1]
 Out[7]: 0.25
 
 
 linspace gives a slightly different answer, because
 it includes the
 endpoint.  Sometimes this is what you want,
 sometimes not.
 



   

The fish are biting. 
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php

-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Translating ticks a la MultipleLocator ?

2007-04-10 Thread John Hunter
On 4/10/07, Iyer [EMAIL PROTECTED] wrote:
 I apologize if I haven't been sufficiently clear.

 While your suggestion picks out the samples from the
 sample set, and discards other samples - what I was
 looking at --

 when I plot a sample set, of say - 1000 points, the
 xticks shows up as 0 to 1000 points on the plot.

 I was wondering if there could be a way to translate
 the xtick display to that of seconds, if the sampling
 frequency is 250 Hz, the plot would still display the
 original data set, but with different xticks -- for
 e.g. it would display xticks as 0 to 4 seconds rather
 than 0 to 1000 points.. hence is there a good way to
 translate ticks ?

Yes, you can certainly do this, but what we are suggesting is that it
makes more sense to simply scale your data before plotting.  Is there
a reason you don't want to do this

  ax.plot(ind*dt, y)

The index locator

JDH

-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Translating ticks a la MultipleLocator ?

2007-04-10 Thread Iyer

Wouldn't it make sense to simply change the xticks to
reflect the time instead of the number of data points
?

Like, if we needed to display 0 t0 1000 points over a
period of time, wouldn't it be nice to translate the
xticks to reflect the period of time ?

Would you suggest using IndexLocator in that sense ?

-iyer

 hence is there a good way
 to
  translate ticks ?
 
 Yes, you can certainly do this, but what we are
 suggesting is that it
 makes more sense to simply scale your data before
 plotting.  Is there
 a reason you don't want to do this
 
   ax.plot(ind*dt, y)
 
 The index locator
 
 JDH
 



   

Looking for earth-friendly autos? 
Browse Top Cars by Green Rating at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/

-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problems building/installing

2007-04-10 Thread Stephen Uhlhorn
Hello Simon-

I have experimented with every conceivable python/numpy/mpl
permutation on mac os and I will second Chris Barker's recommendation.
Use the pythonmac.org packages with the wx backend. Choose whichever
version of wx and python that is best supported my the mpl version.

I use mpl v 0.87, wx 2.6. and python 2.4 on my ppc mac.

-stephen

On 4/5/07, Christopher Barker [EMAIL PROTECTED] wrote:
 Simson Garfinkel wrote:
  I'm embarrassed to ask that I'm having trouble building/installing
  matplotlib on an intel Mac.

 Don't be embarassed -- it's really pretty hard!

 All the various pythons (Universal, fink, darwinports, etc) for OS-X
 confuse things a lot, but I think you'll get the best support if you
 stick with the official framework Universal build:

 http://www.python.org/download/

 You can also get it from:

 http://www.pythonmac.org/packages/py25-fat/index.html

 The cool thing about that site is that you can get a bunch of pr-built
 compatible packages from there also.

 Unfortunately, the matplotlib there right now doesn't appear to work
 with the latest wxPython. I'm not sure which wxPython version it is
 built against, but it crashed for me when used with wxPython2.8.3

 The good news is, as I understand it, is the Ken McIvor patched the most
 recent MPL to use wxPython 2.8b features that allow you to build MPL
 without linking to wxPython.

 Hopefully someone will do a build that works with wxPython2.8.3 and put
 it up on the pythonmac site soon. I may even do it, but I haven't needed
 to for a while, so I don't have it all set up at this point.

 If you're going to built it yourself, still use the pythonmac packages
 for everything else, you'll be glad you did.

 -Chris

 -
 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.phpp=sourceforgeCID=DEVDEV
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] problems building/installing

2007-04-10 Thread Christopher Barker
Stephen Uhlhorn wrote:
 I have experimented with every conceivable python/numpy/mpl
 permutation on mac os and I will second Chris Barker's recommendation.
 Use the pythonmac.org packages with the wx backend. Choose whichever
 version of wx and python that is best supported my the mpl version.
 
 I use mpl v 0.87, wx 2.6. and python 2.4 on my ppc mac.

I think mpl 9.0, python 2.5 and wx 2.6 will work OK too. I'm working 
right now on getting a version that will work well with wxPython2.8 -- 
but I'm not there yet.

-Chris

-- 
Christopher Barker, Ph.D.
Oceanographer

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

[EMAIL PROTECTED]

-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Translating ticks a la MultipleLocator ?

2007-04-10 Thread John Hunter
On 4/10/07, John Hunter [EMAIL PROTECTED] wrote:
 On 4/10/07, Iyer [EMAIL PROTECTED] wrote:
  I apologize if I haven't been sufficiently clear.
 
  While your suggestion picks out the samples from the
  sample set, and discards other samples - what I was
  looking at --

My suggestion does not discard other samples, so you may not be
understanding what I am saying.  Perhaps you can try the suggested
code and see if it does what you want.  My example plots all the
samples; it simply scales the xaxis to represent time and not sample
number.

-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Histogram align 'edge' or 'center' bug?

2007-04-10 Thread Jouni K . Seppänen
David Fokkema [EMAIL PROTECTED] writes:

 I can't think of an application where you have bins of different
 widths and you want to center the values...

Actually, now that I think about it, there is not enough information
in the bin centers to know the widths of the bins if they may vary.
For example, if your bin edges are (2, 4, 8, 16, 32) or (1, 5, 7, 17,
31), you get the same bin centers (3, 6, 12, 24). Perhaps it's best to
disallow variable-width bins when align='center'.

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


-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Translating ticks a la MultipleLocator ?

2007-04-10 Thread Eric Firing
There seems to be a huge misunderstanding here, and I am not sure what 
it is, but what you need to do is run examples and experiment with 
variations until you have some inkling of what mpl is actually doing. 
  Start with   http://matplotlib.sourceforge.net/tutorial.html.

Please note that the ticks are simply labeled locations--they have no 
effect on what data are plotted.

When you do ax.plot(ind*dt, y), absolutely *nothing* is lost; every 
value of y in your array is plotted. mpl is plotting (x,y) pairs--all of 
them--and labeling the axes accordingly.

To see what is being plotted, you can use plot(x,y,'ro'), for example, 
to plot each point as a red circle.  Experiment with this.

Don't worry right now about avoiding the pylab interface; take advantage 
of its simplicity to get the most basic plotting concepts straightened 
out via quick experimentation.  Use the gui zoom button to see how axis 
labeling works.  Make your own simple examples; plot random points, plot 
sin waves.

Eric

Iyer wrote:
 It is not what I need..
 
 http://matplotlib.sourceforge.net/matplotlib.axes.html
 
 The plot method (plot(self, *args, **kwargs)) accepts
 only x,y pairs, in ax.plot(ind*dt, y) -- the x
 parameter is ind*dt - the sample times, but the data
 between the sample points is lost. IMHO, the likely
 way to prevent loss of sampled data points is changing
 the ticks, isn't that possible to change the ticks,
 while keeping the data as it is -- plotted as if it
 were for a number of data points.
 
 -iyer
 
 
 
 
 --- John Hunter [EMAIL PROTECTED] wrote:
 
 On 4/10/07, John Hunter [EMAIL PROTECTED] wrote:
 On 4/10/07, Iyer [EMAIL PROTECTED] wrote:
 I apologize if I haven't been sufficiently
 clear.
 While your suggestion picks out the samples from
 the
 sample set, and discards other samples - what I
 was
 looking at --
 My suggestion does not discard other samples, so
 you may not be
 understanding what I am saying.  Perhaps you can try
 the suggested
 code and see if it does what you want.  My example
 plots all the
 samples; it simply scales the xaxis to represent
 time and not sample
 number.

 
 
 

 
 Looking for earth-friendly autos? 
 Browse Top Cars by Green Rating at Yahoo! Autos' Green Center.
 http://autos.yahoo.com/green_center/
 
 -
 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.phpp=sourceforgeCID=DEVDEV
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] AttributeError: LineCollection instance has no attribute 'get_lines'

2007-04-10 Thread Eric Firing
Ted Drain wrote:
 John,
 One of the problems we've had is trying to design an auto-scaling 
 algorithm that works well with any type date format since the date 
 strings can be so large horizontally.  I believe that having the draw 
 time elements be able to query the renderer for things would help 
 this out tremendously since we could then have the tick generator 
 space out the dates along nice boundaries without overlapping the date 
 strings.

This is only half of the solution; the other half is controlling the 
order in which things are done.  In its most general form, this would 
involve some sort of dependency tree, automatically generated.  I 
imagine this is how layout engines work.  I know that Andrew contributed 
one quite some time ago, and so far I have done nothing with it. (Sorry, 
Andrew.)  A simpler mechanism suggested by John was a set of pre- and 
post- hooks in draw functions that would enable one to manually put in 
dependencies and ensure that dependent calculations are done in the 
right order.  In all of this, it is critical to avoid chicken-and-egg 
situations: e.g., label font size depends on physical room available, 
but tick spacing adjusts to accommodate the labels.

The transforms module already does part of what we are talking about 
here; dependency information is accumulated as BinOps are built from 
other BinOps, and everything is resolved at rendering time.

I think that any changes like this need to wait in line behind the 
upcoming numpyfication, and it would be nice to have some full outlines 
of alternative strategies before picking one and proceeding.

Ideas and strategy sketches tend to get lost in the email stack; would 
it help to have a wiki page for discussion of major design questions 
like this?  Or is this overkill?

Eric

 
 Ted
 
 At 01:07 PM 4/7/2007, John Hunter wrote:
 On 4/7/07, Eric Firing [EMAIL PROTECTED] wrote:

 I put back get_lines() in collections and fixed a related bug in legend,
 so the test script now works in the sense that it makes a legend.  It
 puts in an unlabeled line, presumably corresponding to the line
 collection making up the error bars. Maybe legend provides a way to
 avoid this.  I haven't looked.
 If I'm understanding the problem you are describing correctly, it
 looks like _nolegend_ needs to be set here. For artists we do not want
 to be included in the legend, the label should be set to '_nolegend_'
 and legend will ignore it in auto-legending.  Or at least it should
 and if it is not it is a bug.

 The larger problem, and the one that probably made me yank get_lines
 (without realizing the legend code was using it--my mistake--I do try to
 check for things like that) is that legend really wants to know the
 draw-time locations of all plot elements, and for collections (among
 other things) this cannot be determined in general.  The collection
 get_lines and get_verts methods can give the right answer to legend only
 if the data and offset transforms are the same.  Sometimes they are,
 sometimes they are not. LineCollection.get_lines() probably could be
 improved to do a better job than at present, but never a perfect one.
 One approach is to make every artist provide a get window extent which
 returns a bounding box.  There is the issue of how to get the renderer
 before draw time, but we could fix this.  It would be nice for draw
 time layout algorithms to be able to assume this method, and a few
 objects already provide it, eg text.

 This is an example of a more widespread problem that we have thought
 about and discussed (including some good ideas from John, of course),
 but solving it is not simple.  For the time being, at least, we are
 stuck with some imperfections.

 In any case, thanks for bringing the legend/LineCollection bug to my
 attention.  This is the sort of thing it is nice to get cleaned up
 before the next release, coming soon.  Do you know of some other simple
 bugs like this we should look at ASAP?

 I added unit/legend_unit.py script to create legends using a scatter
 and vlines, which create RegPolyCollections and LineCollections.  We
 should use more stuff like this in general, unit scripts which
 exercise the more arcane usages.

 JDH

-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] AttributeError: LineCollection instance has no attribute 'get_lines'

2007-04-10 Thread John Hunter
On 4/10/07, Eric Firing [EMAIL PROTECTED] wrote:

 Ideas and strategy sketches tend to get lost in the email stack; would
 it help to have a wiki page for discussion of major design questions
 like this?  Or is this overkill?

My preference is for (possibly structured) text documents in the svn
repo, ala CODING_GUIDE

-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Gnome problem when plotting with mpl

2007-04-10 Thread Eric Emsellem
Hi,

a problem that I have since some time now using mpl: everytime I start
plotting, I get something like:

(python:6374): GnomePrintCupsPlugin-WARNING **: iconv does not support
ppd character encoding: ISOLatin1, trying CSISOLatin1

I know this is not really a mpl problem, but if anybody has a clue, it
is welcome!

cheers
Eric

matplotlib version 0.87.7
verbose.level helpful
interactive is False
platform is linux2
numerix numpy 1.0.2.dev3534
font search path
['/usr/local/lib/python2.4/site-packages/matplotlib/mpl-data']
backend WXAgg version 2.6.2.1
Python 2.4.2 (#1, May  2 2006, 08:13:46)


on Suse 10.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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Translating ticks a la MultipleLocator ?

2007-04-10 Thread John Hunter
On 4/10/07, Iyer [EMAIL PROTECTED] wrote:

 If only someone could guide me, so that I can
 understand better how to translate the ticks from
 the default number of sample ticks to that of
 different ticks - say
 new_ticks=original_ticks/(some_constant). Right now
 I'm clueless, your input will help a lot in
 understanding Mpl.


OK, your persistence is admirable.  You are still asking the wrong
question and applying the wrong solution, but dog-golly, you've earned
the right to do it the wrong way!

from matplotlib.ticker import FuncFormatter

def myformatter(x, pos=None):
 return '%1.3f'%(x/4.)

ax = subplot(111)
ax.plot(x, y)
ax.xaxis.set_major_formatter(FuncFormatter(myformatter))

Now all your ticks are magically divided by 4.

But really, simply scaling your x input data is the way to go.  If we
want to move this conversation forward, you should try instead

  plot(x/4, y)

and then explain as clearly as possibly this doesn't do what you want.

-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] . Newbie. Interactive and saving plots to file

2007-04-10 Thread brett . mcsweeney
Just started using matplotlib (it's great!) interactively (using ipython, 
TkAgg backend) and am moving into saving plots to file.

I edited the matplotlibrc to interactive: False and backend: Agg, and it 
works great. (produces .png)

I would normally like to muck around interactively to get the plot right, 
then save it to png once I'm happy with it.

The question is, do people wanting to do this have to edit the 
matplotlibrc and restart Python each time, or is there some other way?

editorial:  What a great combination is Python and matplotlib!

Thanks.


UNITED GROUP
This email message is the property of United Group. The information in this 
email is confidential and may be legally privileged. It is intended solely for 
the addressee. Access to this email by anyone else is unauthorised. If you are 
not the intended recipient, you may not disclose, copy or distribute this 
email, nor take or omit to take any action in reliance on it. United Group 
accepts no liability for any damage caused by this email or any attachments due 
to viruses, interference, interception, corruption or unauthorised access.
If you have received this email in error, please notify United Group 
immediately by email to the sender's email address and delete this document.-
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.phpp=sourceforgeCID=DEVDEV___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Translating ticks a la MultipleLocator ?

2007-04-10 Thread Jouni K . Seppänen
Iyer [EMAIL PROTECTED] writes:

 With all respect, I have certainly perused the
 tutorials before posting the question. 

From your postings it seems that you are misunderstanding some
fundamental concepts, but it is not clear how. Can you write up a
little piece of code showing what you are doing now, and explain how
you would like the output changed? Just make up some data and plot it,
and point out what is wrong about the result.

As an example of how to phrase your question, here is how I would
write the question I thought you were trying to communicate a few
emails ago:

  --
  The following script makes an otherwise good plot, but I want the
  x-axis to go from 0 to 1, not 0 to 10. How do I do this?

  x = arange(0,10,0.5)
  y = sin(x)
  plot(x,y)
  --

The best answer to *that* question, which you got from John Hunter, is
to change the script to the following:

  x = arange(0,10,0.5)
  y = sin(x)
  dt = 1.0/10
  plot(x*dt,y)

Since you say that this does not solve your problem, that must not
have been the question you intended to ask. Perhaps rephrasing the
question using a code example would help make your point clearer.

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


-
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.phpp=sourceforgeCID=DEVDEV
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users