You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
| 2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
| 2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
| 2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
| 2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
| 2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
| 2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
| 2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
| 2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
| 2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
| 2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
| 2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
| 2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
| 2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
1
(12) |
2
(13) |
3
(14) |
4
(9) |
|
5
(9) |
6
(22) |
7
(17) |
8
(16) |
9
(19) |
10
(17) |
11
(6) |
|
12
|
13
(20) |
14
(21) |
15
(20) |
16
(10) |
17
(14) |
18
(3) |
|
19
(3) |
20
(12) |
21
(22) |
22
(26) |
23
(31) |
24
(26) |
25
(9) |
|
26
(4) |
27
(33) |
28
(15) |
29
(37) |
30
(26) |
|
|
|
From: Eric F. <ef...@ha...> - 2009-04-20 22:18:35
|
Gökhan SEVER wrote: > Eric, > > As you said, your program features more than what me in my mind. It > looks very cool. There are some parts which I don't understand quite well. > > I will definitely save it for my future programming adventures. I will > solely use it in my academical research, since I am a graduate student > working on atmospheric sciences. > > I like the Mercurial repository of the project, and the way it is > presented. I am planning establish something similar to yours. So in the > future I might have some more questions to you. > > By the way, could please tell me more what does pycurrents do? I can > guess a little from its name. Actually for the next year I have a plan > of implementing a design named pyclouds for simple cloud simulation > and/or modelling. > > Gökhan Gökhan, pycurrents is simply a name for one of several repos into which we have divided our code; it is for python code that we use for our work in physical oceanography, with a heavy weighting toward processing acoustic Doppler current profiler (ADCP) data. It is a catch-all. It includes good stuff, work in progress (to some extent that description applies to everything), and some things that are obsolete and/or first tries still waiting to be rewritten. For context, see http://currents.soest.hawaii.edu/. Eric |
|
From: Elan P. <el...@MI...> - 2009-04-20 21:50:52
|
Hi, I'm trying to use matplotlib for animating data as it is received from an online source (online in the algorithmic sense not internet:). I'd like the graph plot to be updated with high frequency since the data changes rapidly. I've used the BufferRegion with copy_from_bbox / restore_region and it speeds up the plotting considerably but alas it's still not good enough (with a large number of graphs and a large number of data points in each graph). What I'd like to do is to utilize the fact that the animation is updated in a predictable fashion (i.e., scrolling off the screen to the left as new data arrives) in order to speed up the animation. The idea would be to copy the right 99% of the graph (or some other fraction) via some kind of function similar to copy_from_bbox, move it 1% to the left and then plot the new 1% of the data. The problem is that as far as I can tell the copy_from_bbox/restore_region does not actually allow changing the area in which it is restored. I've mucked around in the source files a bit but to no avail. My question is then: 1. Is there some other way to copy everything enclosed in a Bbox? or 2. Is there some way to modify the region in which data reappears when using restore_region? 3. Perhaps I'm missing something? I'm sure someone else has done this since it seems pretty natural and useful for a variety of applications. Elan ---- "If stupidity got us into this mess, why can't it get us out?" - Will Rogers |
|
From: Gökhan S. <gok...@gm...> - 2009-04-20 21:22:36
|
Eric, As you said, your program features more than what me in my mind. It looks very cool. There are some parts which I don't understand quite well. I will definitely save it for my future programming adventures. I will solely use it in my academical research, since I am a graduate student working on atmospheric sciences. I like the Mercurial repository of the project, and the way it is presented. I am planning establish something similar to yours. So in the future I might have some more questions to you. By the way, could please tell me more what does pycurrents do? I can guess a little from its name. Actually for the next year I have a plan of implementing a design named pyclouds for simple cloud simulation and/or modelling. Gökhan On Mon, Apr 20, 2009 at 1:29 PM, Eric Firing <ef...@ha...> wrote: > Matthias Michler wrote: > > Hi Gökhan, > > > > On Friday 17 April 2009 20:21:00 Gökhan SEVER wrote: > >> Thanks for the pointer Matthias, > >> > >> That is exactly what I have been looking for. > > You might also find useful ideas here: > > > http://currents.soest.hawaii.edu/hg/hgwebdir.cgi/pycurrents/file/2ec7845a90c3/plot/txyzoom.py#l1 > > I haven't followed this thread closely, but my impression is that what > you are trying to do is similar to, but perhaps simpler than, what is > done by txyzoom.py. > > I don't have license info in the file or repo yet, but consider it > available under a matplotlib-style license. > > Eric > > >> > >> I use the code from the RectangleSelector class help with your suggested > >> code. I know that I have to update y-axis accordingly to x values such > that > >> their positions and sizes must much so that I can plot them in a new > plot. > >> And I know that the answer lies in a mask; I have to create a mask from > >> x_new and apply it to y. Do you have any hint on this? > > > > Unfortunately I'm not familiar with numpy masks, but what I would do is: > > > > xmin = min(eclick.xdata, erelease.xdata) > > xmax = max(eclick.xdata, erelease.xdata) > > ymin = min(eclick.ydata, erelease.ydata) > > ymax = max(eclick.ydata, erelease.ydata) > > # indices inside x-range > > indices = (x>= xmin) & (x <= xmax) > > # OR: indices for data inside the selected rectangle > > #indices = (x>= xmin) & (x <= xmax) & (y>=ymin) & (y<=ymax) > > xnew = x[indices] > > ynew = y[indices] > > > >> Another point is do you have any idea how to save values from inside > >> onselect action? > > > > What do you mean by saving? > > Saving to disk? > > # for ascii format I use: > > from scipy.io import write_array > > > > # for numpy arrays you can use > > import numpy as np > > a = np.arange(10) > > a.tofile # Write array to a file as text or binary. > > > > and I think there is also some Matplotlib function for this. In the > module > > matplotlib.mlab, which also allows reading different types of formatted > data. > > > > If you think of saving inside the program. You need a global variable > > (statement "global x" at the beginning of onselect) otherwise all > variables > > are deleted at the end of each onselect call. > > > >> For some reason my ipython session doesn't remember values after I run > the > >> given script: > > > > see three lines above, please. > > > > best regards Matthias > >> from matplotlib.widgets import RectangleSelector > >> from pylab import * > >> > >> def onselect(eclick, erelease): > >> # eclick and erelease are matplotlib events at press and release > >> print ' startposition : (%f, %f)' % (eclick.xdata, eclick.ydata) > >> print ' endposition : (%f, %f)' % (erelease.xdata, erelease.ydata) > >> print ' used button : ', eclick.button > >> xmin = min(eclick.xdata, erelease.xdata) > >> xmax = max(eclick.xdata, erelease.xdata) > >> ymin = min(eclick.ydata, erelease.ydata) > >> ymax = max(eclick.ydata, erelease.ydata) > >> x_new = x[(x>= xmin) & (x <= xmax)] > >> #mask = [x == x_new[i] for i in range(len(x_new))] > >> #print mask > >> #print len(x_new) > >> #print len(y_new) > >> #fig_new = figure() > >> #plot(x_new, y_new) > >> #fig_new.show() > >> > >> def toggle_selector(event): > >> print ' Key pressed.' > >> if event.key in ['Q', 'q'] and toggle_selector.RS.active: > >> print ' RectangleSelector deactivated.' > >> toggle_selector.RS.set_active(False) > >> if event.key in ['A', 'a'] and not toggle_selector.RS.active: > >> print ' RectangleSelector activated.' > >> toggle_selector.RS.set_active(True) > >> > >> x = arange(100)/(99.0) > >> y = sin(x) > >> fig = figure > >> ax = subplot(111) > >> ax.plot(x,y) > >> > >> toggle_selector.RS = RectangleSelector(ax, onselect, drawtype='box') > >> connect('key_press_event', toggle_selector) > >> show() > >> > >> Gökhan > >> > >> > >> On Fri, Apr 17, 2009 at 2:31 AM, Matthias Michler > >> > >> <Mat...@gm...>wrote: > >>> Hi Gökhan, > >>> > >>> I recommend you to use matplotlib.widgets.RectangleSelector instead of > >>> the zoom functionality to select the data (An example can be found at > >>> > http://matplotlib.sourceforge.net/examples/widgets/rectangle_selector.htm > >>> l). This will return you the x and y-coordinate of button press and > button > >>> release > >>> event and with that you can take a portion of your data. > >>> Something like the following could be a starting point: > >>> x_min = min(eclick.xdata, erelease.xdata) > >>> x_max = max(eclick.xdata, erelease.xdata) > >>> x_new = x[(x>= x_min) & (x <= x_max)] > >>> > >>> where eclick and erelease correspond to the click and release event of > >>> the rectangle selection (see the example below). > >>> > >>> Opening a new figure after show can be achieved by: > >>> > >>> fig_new = plt.figure() > >>> # some plotting > >>> fig_new.show() # show up the new figure > >>> > >>> > >>> best regards Matthias > >>> > >>> > >>> yet another example for the usage of the RectangleSelector copied from > >>> its class documentation: > >>> > >>> """ > >>> Select a min/max range of the x axes for a matplotlib Axes > >>> > >>> Example usage:: > >>> > >>> from matplotlib.widgets import RectangleSelector > >>> from pylab import * > >>> > >>> def onselect(eclick, erelease): > >>> 'eclick and erelease are matplotlib events at press and > release' > >>> print ' startposition : (%f, %f)' % (eclick.xdata, > eclick.ydata) > >>> print ' endposition : (%f, %f)' % (erelease.xdata, > >>> erelease.ydata) > >>> print ' used button : ', eclick.button > >>> > >>> def toggle_selector(event): > >>> print ' Key pressed.' > >>> if event.key in ['Q', 'q'] and toggle_selector.RS.active: > >>> print ' RectangleSelector deactivated.' > >>> toggle_selector.RS.set_active(False) > >>> if event.key in ['A', 'a'] and not > toggle_selector.RS.active: > >>> print ' RectangleSelector activated.' > >>> toggle_selector.RS.set_active(True) > >>> > >>> x = arange(100)/(99.0) > >>> y = sin(x) > >>> fig = figure > >>> ax = subplot(111) > >>> ax.plot(x,y) > >>> > >>> toggle_selector.RS = RectangleSelector(ax, onselect, > >>> drawtype='line') > >>> connect('key_press_event', toggle_selector) > >>> show() > >>> """ > >>> > >>> On Friday 17 April 2009 02:26:51 Gökhan SEVER wrote: > >>>> Hello, > >>>> > >>>> A quick question: > >>>> > >>>> I am using two numpy arrays to plot the figure shown in attachment. Is > >>>> it possible to get array indices of selected X-axes while using the > >>>> zoom function? Later I can create a new figure from this selected > >>>> portion instead of the same figure and/or apply an analysis. > >>>> > >>>> Thank you. > >>> > ------------------------------------------------------------------------- > >>> ----- Stay on top of everything new and different, both inside and > >>> around Java (TM) technology - register by April 22, and save > >>> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. > >>> 300 plus technical and hands-on sessions. Register today. > >>> Use priority code J9JMT32. http://p.sf.net/sfu/p > >>> _______________________________________________ > >>> Matplotlib-users mailing list > >>> Mat...@li... > >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > > > > ------------------------------------------------------------------------------ > > Stay on top of everything new and different, both inside and > > around Java (TM) technology - register by April 22, and save > > $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. > > 300 plus technical and hands-on sessions. Register today. > > Use priority code J9JMT32. http://p.sf.net/sfu/p > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > ------------------------------------------------------------------------------ > Stay on top of everything new and different, both inside and > around Java (TM) technology - register by April 22, and save > $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. > 300 plus technical and hands-on sessions. Register today. > Use priority code J9JMT32. http://p.sf.net/sfu/p > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
|
From: Gökhan S. <gok...@gm...> - 2009-04-20 21:16:45
|
Thanks for elegant trick Matthias.
I have modified onselect function following your suggestions, and it is
working as I wanted it to be. Select a portion and get a zoomed view in a
new figure.
def onselect(eclick, erelease):
# eclick and erelease are matplotlib events at press and release
global x_new
global y_new
print ' startposition : (%f, %f)' % (eclick.xdata, eclick.ydata)
print ' endposition : (%f, %f)' % (erelease.xdata, erelease.ydata)
print ' used button : ', eclick.button
xmin = min(eclick.xdata, erelease.xdata)
xmax = max(eclick.xdata, erelease.xdata)
ymin = min(eclick.ydata, erelease.ydata)
ymax = max(eclick.ydata, erelease.ydata)
indices = (x >= xmin) & (x <= xmax) & (y >= ymin) & (y <= ymax)
x_new = x[indices]
y_new = y[indices]
fig_new = figure()
plot(x_new, y_new)
fig_new.show()
There is still a minute point, that I would like mention again. Even though
I used global style variables I can't still see them when I quit the
program.
What I do is run the file within IPython by run command. In my case the file
is 'rect.py.' and I do run rect.py. When I quit and do whos querry, I can't
see global x_new nor y_new at the resulting lines:
In [13]: whos
Variable Type Data/Info
--------------------------------------------
RectangleSelector classobj matplotlib.widgets.RectangleSelector
ax AxesSubplot Axes(0.125,0.1;0.775x0.8)
fig function <function figure at 0xa752c6c>
onselect function <function onselect at 0xac0ec34>
toggle_selector function <function toggle_selector at 0xac0ef0c>
x ndarray 100: 100 elems, type `float64`, 800 bytes
y ndarray 100: 100 elems, type `float64`, 800 bytes
For the masking, I was planning to use a masking scheme as given below. Let
say I have an array which "a"
In [14]: a = arange(5)
In [15]: a
Out[15]: array([0, 1, 2, 3, 4])
and my secondary array is "b"
In [16]: b = array([2,3])
What I want to do is to mask a with b values and get an array of:
[array([False, False, True, True, False], dtype=bool)]
That is just an manually created array. I still don't know how to do this
programmatically in Pythonic fashion.
Again thanks for your help.
Gökhan
On Mon, Apr 20, 2009 at 4:09 AM, Matthias Michler
<Mat...@gm...>wrote:
> Hi Gökhan,
>
> On Friday 17 April 2009 20:21:00 Gökhan SEVER wrote:
> > Thanks for the pointer Matthias,
> >
> > That is exactly what I have been looking for.
> >
> > I use the code from the RectangleSelector class help with your suggested
> > code. I know that I have to update y-axis accordingly to x values such
> that
> > their positions and sizes must much so that I can plot them in a new
> plot.
> > And I know that the answer lies in a mask; I have to create a mask from
> > x_new and apply it to y. Do you have any hint on this?
>
> Unfortunately I'm not familiar with numpy masks, but what I would do is:
>
> xmin = min(eclick.xdata, erelease.xdata)
> xmax = max(eclick.xdata, erelease.xdata)
> ymin = min(eclick.ydata, erelease.ydata)
> ymax = max(eclick.ydata, erelease.ydata)
> # indices inside x-range
> indices = (x>= xmin) & (x <= xmax)
> # OR: indices for data inside the selected rectangle
> #indices = (x>= xmin) & (x <= xmax) & (y>=ymin) & (y<=ymax)
> xnew = x[indices]
> ynew = y[indices]
>
> > Another point is do you have any idea how to save values from inside
> > onselect action?
>
> What do you mean by saving?
> Saving to disk?
> # for ascii format I use:
> from scipy.io import write_array
>
> # for numpy arrays you can use
> import numpy as np
> a = np.arange(10)
> a.tofile # Write array to a file as text or binary.
>
> and I think there is also some Matplotlib function for this. In the module
> matplotlib.mlab, which also allows reading different types of formatted
> data.
>
> If you think of saving inside the program. You need a global variable
> (statement "global x" at the beginning of onselect) otherwise all variables
> are deleted at the end of each onselect call.
>
> > For some reason my ipython session doesn't remember values after I run
> the
> > given script:
>
> see three lines above, please.
>
> best regards Matthias
> >
> > from matplotlib.widgets import RectangleSelector
> > from pylab import *
> >
> > def onselect(eclick, erelease):
> > # eclick and erelease are matplotlib events at press and release
> > print ' startposition : (%f, %f)' % (eclick.xdata, eclick.ydata)
> > print ' endposition : (%f, %f)' % (erelease.xdata, erelease.ydata)
> > print ' used button : ', eclick.button
> > xmin = min(eclick.xdata, erelease.xdata)
> > xmax = max(eclick.xdata, erelease.xdata)
> > ymin = min(eclick.ydata, erelease.ydata)
> > ymax = max(eclick.ydata, erelease.ydata)
> > x_new = x[(x>= xmin) & (x <= xmax)]
> > #mask = [x == x_new[i] for i in range(len(x_new))]
> > #print mask
> > #print len(x_new)
> > #print len(y_new)
> > #fig_new = figure()
> > #plot(x_new, y_new)
> > #fig_new.show()
> >
> > def toggle_selector(event):
> > print ' Key pressed.'
> > if event.key in ['Q', 'q'] and toggle_selector.RS.active:
> > print ' RectangleSelector deactivated.'
> > toggle_selector.RS.set_active(False)
> > if event.key in ['A', 'a'] and not toggle_selector.RS.active:
> > print ' RectangleSelector activated.'
> > toggle_selector.RS.set_active(True)
> >
> > x = arange(100)/(99.0)
> > y = sin(x)
> > fig = figure
> > ax = subplot(111)
> > ax.plot(x,y)
> >
> > toggle_selector.RS = RectangleSelector(ax, onselect, drawtype='box')
> > connect('key_press_event', toggle_selector)
> > show()
> >
> > Gökhan
> >
> >
> > On Fri, Apr 17, 2009 at 2:31 AM, Matthias Michler
> >
> > <Mat...@gm...>wrote:
> > > Hi Gökhan,
> > >
> > > I recommend you to use matplotlib.widgets.RectangleSelector instead of
> > > the zoom functionality to select the data (An example can be found at
> > >
> http://matplotlib.sourceforge.net/examples/widgets/rectangle_selector.htm
> > >l). This will return you the x and y-coordinate of button press and
> button
> > > release
> > > event and with that you can take a portion of your data.
> > > Something like the following could be a starting point:
> > > x_min = min(eclick.xdata, erelease.xdata)
> > > x_max = max(eclick.xdata, erelease.xdata)
> > > x_new = x[(x>= x_min) & (x <= x_max)]
> > >
> > > where eclick and erelease correspond to the click and release event of
> > > the rectangle selection (see the example below).
> > >
> > > Opening a new figure after show can be achieved by:
> > >
> > > fig_new = plt.figure()
> > > # some plotting
> > > fig_new.show() # show up the new figure
> > >
> > >
> > > best regards Matthias
> > >
> > >
> > > yet another example for the usage of the RectangleSelector copied from
> > > its class documentation:
> > >
> > > """
> > > Select a min/max range of the x axes for a matplotlib Axes
> > >
> > > Example usage::
> > >
> > > from matplotlib.widgets import RectangleSelector
> > > from pylab import *
> > >
> > > def onselect(eclick, erelease):
> > > 'eclick and erelease are matplotlib events at press and
> release'
> > > print ' startposition : (%f, %f)' % (eclick.xdata,
> eclick.ydata)
> > > print ' endposition : (%f, %f)' % (erelease.xdata,
> > > erelease.ydata)
> > > print ' used button : ', eclick.button
> > >
> > > def toggle_selector(event):
> > > print ' Key pressed.'
> > > if event.key in ['Q', 'q'] and toggle_selector.RS.active:
> > > print ' RectangleSelector deactivated.'
> > > toggle_selector.RS.set_active(False)
> > > if event.key in ['A', 'a'] and not
> toggle_selector.RS.active:
> > > print ' RectangleSelector activated.'
> > > toggle_selector.RS.set_active(True)
> > >
> > > x = arange(100)/(99.0)
> > > y = sin(x)
> > > fig = figure
> > > ax = subplot(111)
> > > ax.plot(x,y)
> > >
> > > toggle_selector.RS = RectangleSelector(ax, onselect,
> > > drawtype='line')
> > > connect('key_press_event', toggle_selector)
> > > show()
> > > """
> > >
> > > On Friday 17 April 2009 02:26:51 Gökhan SEVER wrote:
> > > > Hello,
> > > >
> > > > A quick question:
> > > >
> > > > I am using two numpy arrays to plot the figure shown in attachment.
> Is
> > > > it possible to get array indices of selected X-axes while using the
> > > > zoom function? Later I can create a new figure from this selected
> > > > portion instead of the same figure and/or apply an analysis.
> > > >
> > > > Thank you.
> > >
> > >
> -------------------------------------------------------------------------
> > >----- Stay on top of everything new and different, both inside and
> > > around Java (TM) technology - register by April 22, and save
> > > $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> > > 300 plus technical and hands-on sessions. Register today.
> > > Use priority code J9JMT32. http://p.sf.net/sfu/p
> > > _______________________________________________
> > > Matplotlib-users mailing list
> > > Mat...@li...
> > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
>
>
> ------------------------------------------------------------------------------
> Stay on top of everything new and different, both inside and
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today.
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
|
|
From: fjldurodie <fre...@go...> - 2009-04-20 21:09:21
|
Hi, I'm wondering if it is possible to use SpanSelector on multiple figures : my problem is that I can't think of a way to tell the onselect on which axes(ses) of which figure it should try and do something. The example works because there is only one SpanSelector active and "it" therefore knows which axes "it" should redraw. For it to work on multiple figures (say I have a series of events that I plot in a similar way each in a separate figure and I would like a SpanSelector feature on each of the figures) I would need to have a reference to which axes called the onselect through SpanSelector : then I could get the axes's figure and manipulate the other subplots on that figure accordingly. Is there a way of doing this ? Kind regards, Frederic |
|
From: John S. <pra...@ho...> - 2009-04-20 20:48:46
|
I'm using Mac os 10.4.11. Python is included in mac os. Matplotlib I installed from a precompiled version. I tried doing what you suggest, but it didn't work. I still can't import pylab. There's also a file called libfreetype.6.3.dylib there. I don't know if that helps. > To: mat...@li... > From: jk...@ik... > Date: Mon, 20 Apr 2009 21:52:04 +0300 > Subject: Re: [Matplotlib-users] can't import pylab > > John Seales <pra...@ho...> writes: > > > it's a problem with ft2font. I checked for the existence of the files > > it's looking for, the libfreetype.6.dylib, and ft2font.so – they exist > > in the places they're supposed to. I don't really know what 'image not > > found' exactly means. > > > ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/ft2font.so, 2): Library not loaded: /usr/X11R6/lib/libfreetype.6.dylib > > Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/ft2font.so > > Reason: image not found > > What version of OS X are you using? How did you install Python and > Matplotlib - did you get a precompiled version, or install via Fink or > MacPorts, or compile it yourself? > > Here's a wild guess: since /usr/X11R6 is just a symlink to /usr/X11, the > file /usr/X11R6/lib/libfreetype.6.dylib has an "install name" of > /usr/X11/lib/libfreetype.6.dylib, and perhaps the dynamic linker doesn't > like the mismatch. Do the following commands fix the problem? > > cd /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib > cp ft2font.so ft2font.so.bak > install_name_tool -change /usr/X11R6/lib/libfreetype.6.dylib \ > /usr/X11/lib/libfreetype.6.dylib ft2font.so > > If not, copy ft2font.so.bak back over the modified ft2font.so to prevent > the attempted fix from breaking anything else. > > -- > Jouni K. Seppänen > http://www.iki.fi/jks > > > ------------------------------------------------------------------------------ > Stay on top of everything new and different, both inside and > around Java (TM) technology - register by April 22, and save > $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. > 300 plus technical and hands-on sessions. Register today. > Use priority code J9JMT32. http://p.sf.net/sfu/p > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users _________________________________________________________________ Rediscover Hotmail®: Get quick friend updates right in your inbox. http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Updates2_042009 |
|
From: Jouni K. S. <jk...@ik...> - 2009-04-20 18:52:35
|
John Seales <pra...@ho...> writes: > it's a problem with ft2font. I checked for the existence of the files > it's looking for, the libfreetype.6.dylib, and ft2font.so – they exist > in the places they're supposed to. I don't really know what 'image not > found' exactly means. > ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/ft2font.so, 2): Library not loaded: /usr/X11R6/lib/libfreetype.6.dylib > Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/ft2font.so > Reason: image not found What version of OS X are you using? How did you install Python and Matplotlib - did you get a precompiled version, or install via Fink or MacPorts, or compile it yourself? Here's a wild guess: since /usr/X11R6 is just a symlink to /usr/X11, the file /usr/X11R6/lib/libfreetype.6.dylib has an "install name" of /usr/X11/lib/libfreetype.6.dylib, and perhaps the dynamic linker doesn't like the mismatch. Do the following commands fix the problem? cd /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib cp ft2font.so ft2font.so.bak install_name_tool -change /usr/X11R6/lib/libfreetype.6.dylib \ /usr/X11/lib/libfreetype.6.dylib ft2font.so If not, copy ft2font.so.bak back over the modified ft2font.so to prevent the attempted fix from breaking anything else. -- Jouni K. Seppänen http://www.iki.fi/jks |
|
From: Eric F. <ef...@ha...> - 2009-04-20 18:29:45
|
Matthias Michler wrote: > Hi Gökhan, > > On Friday 17 April 2009 20:21:00 Gökhan SEVER wrote: >> Thanks for the pointer Matthias, >> >> That is exactly what I have been looking for. You might also find useful ideas here: http://currents.soest.hawaii.edu/hg/hgwebdir.cgi/pycurrents/file/2ec7845a90c3/plot/txyzoom.py#l1 I haven't followed this thread closely, but my impression is that what you are trying to do is similar to, but perhaps simpler than, what is done by txyzoom.py. I don't have license info in the file or repo yet, but consider it available under a matplotlib-style license. Eric >> >> I use the code from the RectangleSelector class help with your suggested >> code. I know that I have to update y-axis accordingly to x values such that >> their positions and sizes must much so that I can plot them in a new plot. >> And I know that the answer lies in a mask; I have to create a mask from >> x_new and apply it to y. Do you have any hint on this? > > Unfortunately I'm not familiar with numpy masks, but what I would do is: > > xmin = min(eclick.xdata, erelease.xdata) > xmax = max(eclick.xdata, erelease.xdata) > ymin = min(eclick.ydata, erelease.ydata) > ymax = max(eclick.ydata, erelease.ydata) > # indices inside x-range > indices = (x>= xmin) & (x <= xmax) > # OR: indices for data inside the selected rectangle > #indices = (x>= xmin) & (x <= xmax) & (y>=ymin) & (y<=ymax) > xnew = x[indices] > ynew = y[indices] > >> Another point is do you have any idea how to save values from inside >> onselect action? > > What do you mean by saving? > Saving to disk? > # for ascii format I use: > from scipy.io import write_array > > # for numpy arrays you can use > import numpy as np > a = np.arange(10) > a.tofile # Write array to a file as text or binary. > > and I think there is also some Matplotlib function for this. In the module > matplotlib.mlab, which also allows reading different types of formatted data. > > If you think of saving inside the program. You need a global variable > (statement "global x" at the beginning of onselect) otherwise all variables > are deleted at the end of each onselect call. > >> For some reason my ipython session doesn't remember values after I run the >> given script: > > see three lines above, please. > > best regards Matthias >> from matplotlib.widgets import RectangleSelector >> from pylab import * >> >> def onselect(eclick, erelease): >> # eclick and erelease are matplotlib events at press and release >> print ' startposition : (%f, %f)' % (eclick.xdata, eclick.ydata) >> print ' endposition : (%f, %f)' % (erelease.xdata, erelease.ydata) >> print ' used button : ', eclick.button >> xmin = min(eclick.xdata, erelease.xdata) >> xmax = max(eclick.xdata, erelease.xdata) >> ymin = min(eclick.ydata, erelease.ydata) >> ymax = max(eclick.ydata, erelease.ydata) >> x_new = x[(x>= xmin) & (x <= xmax)] >> #mask = [x == x_new[i] for i in range(len(x_new))] >> #print mask >> #print len(x_new) >> #print len(y_new) >> #fig_new = figure() >> #plot(x_new, y_new) >> #fig_new.show() >> >> def toggle_selector(event): >> print ' Key pressed.' >> if event.key in ['Q', 'q'] and toggle_selector.RS.active: >> print ' RectangleSelector deactivated.' >> toggle_selector.RS.set_active(False) >> if event.key in ['A', 'a'] and not toggle_selector.RS.active: >> print ' RectangleSelector activated.' >> toggle_selector.RS.set_active(True) >> >> x = arange(100)/(99.0) >> y = sin(x) >> fig = figure >> ax = subplot(111) >> ax.plot(x,y) >> >> toggle_selector.RS = RectangleSelector(ax, onselect, drawtype='box') >> connect('key_press_event', toggle_selector) >> show() >> >> Gökhan >> >> >> On Fri, Apr 17, 2009 at 2:31 AM, Matthias Michler >> >> <Mat...@gm...>wrote: >>> Hi Gökhan, >>> >>> I recommend you to use matplotlib.widgets.RectangleSelector instead of >>> the zoom functionality to select the data (An example can be found at >>> http://matplotlib.sourceforge.net/examples/widgets/rectangle_selector.htm >>> l). This will return you the x and y-coordinate of button press and button >>> release >>> event and with that you can take a portion of your data. >>> Something like the following could be a starting point: >>> x_min = min(eclick.xdata, erelease.xdata) >>> x_max = max(eclick.xdata, erelease.xdata) >>> x_new = x[(x>= x_min) & (x <= x_max)] >>> >>> where eclick and erelease correspond to the click and release event of >>> the rectangle selection (see the example below). >>> >>> Opening a new figure after show can be achieved by: >>> >>> fig_new = plt.figure() >>> # some plotting >>> fig_new.show() # show up the new figure >>> >>> >>> best regards Matthias >>> >>> >>> yet another example for the usage of the RectangleSelector copied from >>> its class documentation: >>> >>> """ >>> Select a min/max range of the x axes for a matplotlib Axes >>> >>> Example usage:: >>> >>> from matplotlib.widgets import RectangleSelector >>> from pylab import * >>> >>> def onselect(eclick, erelease): >>> 'eclick and erelease are matplotlib events at press and release' >>> print ' startposition : (%f, %f)' % (eclick.xdata, eclick.ydata) >>> print ' endposition : (%f, %f)' % (erelease.xdata, >>> erelease.ydata) >>> print ' used button : ', eclick.button >>> >>> def toggle_selector(event): >>> print ' Key pressed.' >>> if event.key in ['Q', 'q'] and toggle_selector.RS.active: >>> print ' RectangleSelector deactivated.' >>> toggle_selector.RS.set_active(False) >>> if event.key in ['A', 'a'] and not toggle_selector.RS.active: >>> print ' RectangleSelector activated.' >>> toggle_selector.RS.set_active(True) >>> >>> x = arange(100)/(99.0) >>> y = sin(x) >>> fig = figure >>> ax = subplot(111) >>> ax.plot(x,y) >>> >>> toggle_selector.RS = RectangleSelector(ax, onselect, >>> drawtype='line') >>> connect('key_press_event', toggle_selector) >>> show() >>> """ >>> >>> On Friday 17 April 2009 02:26:51 Gökhan SEVER wrote: >>>> Hello, >>>> >>>> A quick question: >>>> >>>> I am using two numpy arrays to plot the figure shown in attachment. Is >>>> it possible to get array indices of selected X-axes while using the >>>> zoom function? Later I can create a new figure from this selected >>>> portion instead of the same figure and/or apply an analysis. >>>> >>>> Thank you. >>> ------------------------------------------------------------------------- >>> ----- Stay on top of everything new and different, both inside and >>> around Java (TM) technology - register by April 22, and save >>> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. >>> 300 plus technical and hands-on sessions. Register today. >>> Use priority code J9JMT32. http://p.sf.net/sfu/p >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > ------------------------------------------------------------------------------ > Stay on top of everything new and different, both inside and > around Java (TM) technology - register by April 22, and save > $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. > 300 plus technical and hands-on sessions. Register today. > Use priority code J9JMT32. http://p.sf.net/sfu/p > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: John S. <pra...@ho...> - 2009-04-20 16:58:59
|
_______________________________________________ Numpy-discussion mailing list Num...@sc... http://mail.scipy.org/mailman/listinfo/numpy-discussion |
|
From: justfred <fj...@te...> - 2009-04-20 16:10:44
|
Hi, I'm wondering if it is possible to use SpanSelector on multiple figures : my problem is that I can't think of a way to tell the onselect on which axes(ses) of which figure it should try and do something. The example works because there is only one SpanSelector active and "it" therefore knows which axes "it" should redraw. For it to work on multiple figures (say I have a series of events that I plot in a similar way each in a separate figure and I would like a SpanSelector feature on each of the figures) I would need to have a reference to which axes called the onselect through SpanSelector : then I could get the axes's figure and manipulate the other subplots on that figure accordingly. Is there a way of doing this ? Kind regards, Frederic -- View this message in context: http://www.nabble.com/SpanSelector-on-multiple-figures-tp23139774p23139774.html Sent from the matplotlib - users mailing list archive at Nabble.com. |