[Matplotlib-users] wx.aui.AuiNotebook with a matplotlib figure on each page CTRL-TAB page to page navigation does not work in OSX works in windows

2012-10-21 Thread hari jayaram
Hi I am using
wxpython : 2.9.4.0
matplotlib : 1.3
osx Lion

In my application I have a number of matplotlib figure objects, one  on
each page of the wx.aui.AuiNotebook .The pages are each a figure and
arranged as tabs on the top of the wxpython frame like embedding in wx5
example from the matplotlib gallery.

On Windows I can navigate from page to page  of the Notebook using CTRL-TAB
and CTRL-SHIFT-TAB.

However on OSX -Lion  , neither the CTRL-TAB, nor Alt/Tab navigate from
page to page.

Instead what happens is that the mouse selection moves from icon to icon
i.e from the Home to the Pan-zoom  icon on the bottom of the matplotlib
figure. The wxAuiNotebook is oblvious of these mouse events.

Does anyone know how to restore the windows os behavior where CTRL-TAB
changes the page of the Notebook on OSX. How do I prevent the matplotlib
figure object from intercepting these events.

Thanks
Hari
--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Histogram with overlapping bins

2012-10-21 Thread fiolj
Hi, some time ago I needed the same thing and hacked the function
histogram (from numpy). Here goes my function, I hope it will result useful

Cheers,
Juan

## Calculates the histogram allowing for overlapping bins, which are
given by
#
# @param a
# @param bins a sequence of pairs (left,right), limits for each bin
#
# @return hist (numpy array)
# bin_centers (numpy array)
def myhistogram(a, bins):
  
  Compute the histogram of a set of data.

  Parameters
  --
  a : array_like
  Input data.
  bins : sequence of pairs
  It defines the bin edges (left,right), allowing for non-uniform
bin widths.

  Returns
  ---
  hist : array
The values of the histogram. See `normed` and `weights` for a
description of the possible semantics.
  bin_centers : array of dtype float
Return the bin centers ``(length(hist))``.

  Notes
  -
  All but the last (righthand-most) bin is half-open.  In other words, if
  `bins` is::

[1, 2, 3, 4]

  then the first bin is ``[1, 2)`` (including 1, but excluding 2) and the
  second ``[2, 3)``.  The last bin, however, is ``[3, 4]``, which *includes*
  4.

  Examples
  
   myhistogram([1,2,1], bins=[(0,1),(1,1.5),(1.5,2.5),(2,3)])
  (array([0.5, 1.25, 2, 2.5]), array([0, 0, 1, 2, 3]))
  
  bins = np.asarray(bins)   # bins are 2-dimensional arrays
of shape (n,2)
  if len(bins.shape) != 2 or bins.shape[1] != 2:
raise AttributeError, 'bins must be a list/array of 2-tuples.'

  a = np.asarray(a)
  a =  a.ravel()
  n = np.zeros(len(bins), int)

  block = 65536
  for i in np.arange(0, len(a), block):
sa = np.sort(a[i:i+block])
n += np.r_[sa.searchsorted(bins[:-1,1], 'left'),
sa.searchsorted(bins[-1,1], 'right')]\
 - np.r_[sa.searchsorted(bins[:-1,0], 'left'),
sa.searchsorted(bins[-1,0], 'right')]
  return n, (bins[:,0]+bins[:,1])/2.

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users