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
(8) |
2
(2) |
3
(8) |
4
(19) |
5
(19) |
6
(25) |
7
(8) |
8
(1) |
9
|
10
(15) |
11
(22) |
12
(8) |
13
(4) |
14
(1) |
15
|
16
(1) |
17
(20) |
18
(17) |
19
(13) |
20
(17) |
21
(7) |
22
(5) |
23
(6) |
24
(14) |
25
(14) |
26
(18) |
27
(21) |
28
(5) |
29
(9) |
30
(6) |
|
|
|
|
|
|
From: John H. <jdh...@ac...> - 2006-04-27 14:55:43
|
>>>>> "Robert" == Robert Cimrman <cim...@nt...> writes: Robert> John Hunter wrote: >>>>>>> "Robert" == Robert Cimrman <cim...@nt...> writes: Robert> Does it work for SciPy sparse matrices Robert> (e.g. scipy.sparse.csr_matrix)? I don't think so... That Robert> is why I provided my solution. Otherwise, of course, I am Robert> well aware of spy, spy2 :-) >> I see -- can you post a simple example (with version nums for >> numpy/scipy/mpl) that exposes the bug. Hopefully there will be >> an easy fix. Robert> Sure: Robert> matplotlib: 0.87.2-r2 Robert> from SVN: numpy: Checked out revision 2433. scipy: Robert> Checked out revision 1888. Robert> The problem is, that you cannot use 'where' for sparse Robert> matrices yet... For spy we can use def spy(self, Z, marker='s', markersize=10, **kwargs): """ SPY(Z, **kwargs) plots the sparsity pattern of the matrix Z using plot markers. kwargs give the marker properties - see help(plot) for more information on marker properties The line handles are returned """ if hasattr(Z, 'tocoo'): c = Z.tocoo() x = c.row y = c.col z = c.data else: x,y,z = matplotlib.mlab.get_xyz_where(Z, Z>0) return self.plot(x+0.5,y+0.5, linestyle='None', marker=marker,markersize=markersize, **kwargs) you may want to plug this into your axes.py and test. For spy2 it is a bit tricker, since it uses an image. One option would be to create a regular array of dimensions MxN and fill in the nonempty cells, but this kind of defeats the purpose of using sparse arrays. Another is to use a special purpose RegularPolygonCollection, and build rectangles at each non-zero pixel. I like this option best because it preserves sparsity and allows colormapping, etc.. JDH |
From: Robert C. <cim...@nt...> - 2006-04-27 13:44:04
|
John Hunter wrote: >>>>>>"Robert" == Robert Cimrman <cim...@nt...> writes: > > > Robert> Does it work for SciPy sparse matrices > Robert> (e.g. scipy.sparse.csr_matrix)? I don't think so... That > Robert> is why I provided my solution. Otherwise, of course, I am > Robert> well aware of spy, spy2 :-) > > I see -- can you post a simple example (with version nums for > numpy/scipy/mpl) that exposes the bug. Hopefully there will be an > easy fix. Sure: matplotlib: 0.87.2-r2 from SVN: numpy: Checked out revision 2433. scipy: Checked out revision 1888. The problem is, that you cannot use 'where' for sparse matrices yet... In [14]:import scipy.sparse as sp In [15]:import scipy as nm In [16]:a = nm.array( [[1, 0, 2, 0, 3]] ) In [17]:b = sp.csr_matrix( a ) In [18]:b Out[18]: <1x5 sparse matrix of type '<type 'float64scalar'>' with 3 stored elements (space for 3) in Compressed Sparse Row format> In [19]:p b (0, 0) 1.0 (0, 2) 2.0 (0, 4) 3.0 In [20]:spy(b ) --------------------------------------------------------------------------- exceptions.TypeError Traceback (most recent call last) /home/eldaran/<console> /usr/lib/python2.4/site-packages/matplotlib/pylab.py in spy(*args, **kwargs) 2184 hold(h) 2185 try: -> 2186 ret = gca().spy(*args, **kwargs) 2187 draw_if_interactive() 2188 except: /usr/lib/python2.4/site-packages/matplotlib/axes.py in spy(self, Z, marker, markersize, **kwargs) 3557 The line handles are returned 3558 """ -> 3559 x,y,z = matplotlib.mlab.get_xyz_where(Z, Z>0) 3560 return self.plot(x+0.5,y+0.5, linestyle='None', 3561 marker=marker,markersize=markersize, **kwargs) /usr/lib/python2.4/site-packages/scipy/sparse/sparse.py in __cmp__(self, other) TypeError: comparison of sparse matrices not implemented In [23]:spy( a ) Out[23]:[<matplotlib.lines.Line2D instance at 0xb5709aac>] |
From: John H. <jdh...@ac...> - 2006-04-27 13:35:13
|
>>>>> "Robert" == Robert Cimrman <cim...@nt...> writes: Robert> Does it work for SciPy sparse matrices Robert> (e.g. scipy.sparse.csr_matrix)? I don't think so... That Robert> is why I provided my solution. Otherwise, of course, I am Robert> well aware of spy, spy2 :-) I see -- can you post a simple example (with version nums for numpy/scipy/mpl) that exposes the bug. Hopefully there will be an easy fix. JDH |
From: Robert C. <cim...@nt...> - 2006-04-27 13:30:53
|
John Hunter wrote: >>>>>>"Nils" == Nils Wagner <nw...@ia...> writes: > > > Nils> Hi all, What is the state-of-the-art of making matrix > Nils> structure plots of sparse matrices with matplotlib ? > > The irony of this question is that you asked the same question in > 2004 and I implemented spy and spy2 in answer: > > http://sourceforge.net/mailarchive/message.php?msg_id=10020115 > http://sourceforge.net/mailarchive/message.php?msg_id=10020116 Does it work for SciPy sparse matrices (e.g. scipy.sparse.csr_matrix)? I don't think so... That is why I provided my solution. Otherwise, of course, I am well aware of spy, spy2 :-) r. |
From: John H. <jdh...@ac...> - 2006-04-27 13:16:10
|
>>>>> "Nils" == Nils Wagner <nw...@ia...> writes: Nils> Hi all, What is the state-of-the-art of making matrix Nils> structure plots of sparse matrices with matplotlib ? The irony of this question is that you asked the same question in 2004 and I implemented spy and spy2 in answer: http://sourceforge.net/mailarchive/message.php?msg_id=10020115 http://sourceforge.net/mailarchive/message.php?msg_id=10020116 JDH |
From: John P. <joh...@st...> - 2006-04-27 12:21:20
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> Hi Nils,<br> <br> I think you're missing the simplicity of pylab if you don't use the 'spy' or 'spy2' approach. Here is what I had to do. (I needed to install the suggested <a class="moz-txt-link-freetext" href="http://matplotlib.sourceforge.net/matplotlibrc">http://matplotlib.sourceforge.net/matplotlibrc</a>, changing 'backend:TkAgg' and 'interactive:True')<br> <br> <img alt="[screenshot]" src="cid:par...@st..." height="394" width="515"><br> <br> Nils Wagner wrote:<br> <blockquote cite="mid...@ia..." type="cite"> <pre wrap=""><!---->Thank you for your feedback. Finally I have used Robert Cimrman's code to generate a matrix structure plot (structure.png). </pre> </blockquote> <br> <pre class="moz-signature" cols="72">-- John Pye Department of Mechanical and Manufacturing Engineering University of New South Wales, Sydney, Australia <a class="moz-txt-link-freetext" href="http://pye.dyndns.org/">http://pye.dyndns.org/</a></pre> </body> </html> |
From: Rudolf S. <rud...@gm...> - 2006-04-27 11:03:15
|
Hello! I started using matblotlib few days ago, and like it. I encountered the following problem: I have a figure with two subplots. I use the toolbar for going back and forth after changing axes' scales. I want to change something in the graphs from time to time -- like shifting some lines elsewhere (by editing lines' properties). By playing with this I found a strange behaviour of the axes() command: I thought that calling simple axes('existing axes instance') should only make the 'existing axes instance' current. But, at least for me, this command also resets the possibility of using back & forward buttons. Is thi= s really wanted? What I truly want to achieve is to be able to use those navigation buttons independently on what is drawn in the axes -- only taking care of the scales. I use the first subplot for visualizing input data, the second subplot for visualizing fft of the input data. I have two additional vertical lines in the former plot for selecting the range of the input data to be then passed to fft. I want to be able to change scales of both graphs at any time and do not discontinue this ability by adding new things to the graphs... 1) is the described behaviour of axes() function intended? 2) what events have some influence on navigation buttons? 3) what shall I read in order to be able to exercise some control over the buttons? Thank you a lot! :) Ruda Sykora |
From: Nils W. <nw...@ia...> - 2006-04-27 10:59:45
|
John Pye wrote: > Hi Nils, > > You've got the 'spy' function, just like in MATLAB. Works a treat. For > example, see under ' Viewing an incidence matrix' on the page: > https://pse.cheme.cmu.edu/wiki/view/Ascend/ScreenShots > > In fact this example uses some tricks to perform colouring of the > plot. All is explained in the matplotlib wiki. > > Cheers > JP > > Nils Wagner wrote: >> Hi all, >> >> What is the state-of-the-art of making matrix structure plots of sparse >> matrices with matplotlib ? >> >> Nils >> >> http://math.nist.gov/MatrixMarket/structureplots.html Thank you for your feedback. Finally I have used Robert Cimrman's code to generate a matrix structure plot (structure.png). However, the entries should lie on the main diagonal instead of the antidiagonal. So what is missing in the code below ? How do I change the orientation of the plots ? from pylab import show, plot, axis, xlabel, subplot, title from scipy import * K = io.mmread('k.mtx') M = io.mmread('m.mtx') print 'Reading finished' rowk = K.row colk = K.col nItemk = len(colk) nRowk, nColk = shape(K) rowm = M.row colm = M.col nItemm = len(colm) nRowm, nColm = shape(M) subplot(211) title('Stiffness matrix') plot( colk + 0.5, rowk + 0.5, linestyle = 'None', marker = ',', markersize = 0.5, markeredgewidth = 0.1 ) axis( [-0.5, nRowk+0.5, -0.5, nColk+0.5] ) axis( 'equal' ) xlabel( '%d x %d: %d nnz, %.2f%% fill' % (nRowk, nColk, nItemk, 100. * nItemk / float( nRowk * nColk )) ) subplot(212) title('Mass matrix') plot( colm + 0.5, rowm + 0.5, linestyle = 'None', marker = ',', markersize = 0.5, markeredgewidth = 0.1 ) axis( [-0.5, nRowm+0.5, -0.5, nColm+0.5] ) axis( 'equal' ) xlabel( '%d x %d: %d nnz, %.2f%% fill' % (nRowm, nColk, nItemm, 100. * nItemm / float( nRowm * nColm )) ) show() |
From: Robert C. <cim...@nt...> - 2006-04-27 09:15:43
|
Nils Wagner wrote: > Hi all, > > What is the state-of-the-art of making matrix structure plots of sparse > matrices with matplotlib ? > > Nils > > http://math.nist.gov/MatrixMarket/structureplots.html I use this simple code: row, col are arrays of indices of nonzero matrix entries nItem long, nRow, nCol is the matrix shape plot( col + 0.5, row + 0.5, linestyle = 'None', marker = ',', markersize = 0.5, markeredgewidth = 0.1 ) axis( [-0.5, nRow+0.5, -0.5, nCol+0.5] ) axis( 'equal' ) xlabel( '%d x %d: %d nnz, %.2f%% fill' % (nRow, nCol, nItem, 100. * nItem / float( nRow * nCol )) ) In SciPy, to get row, col, convert your matrix to the 'COO' format via m = m.tocoo(), then m.row, m.col are your indices. r. |
From: John P. <joh...@st...> - 2006-04-27 08:48:06
|
Hi Nils, You've got the 'spy' function, just like in MATLAB. Works a treat. For example, see under ' Viewing an incidence matrix' on the page: https://pse.cheme.cmu.edu/wiki/view/Ascend/ScreenShots In fact this example uses some tricks to perform colouring of the plot. All is explained in the matplotlib wiki. Cheers JP Nils Wagner wrote: > Hi all, > > What is the state-of-the-art of making matrix structure plots of sparse > matrices with matplotlib ? > > Nils > > http://math.nist.gov/MatrixMarket/structureplots.html -- John Pye Department of Mechanical and Manufacturing Engineering University of New South Wales, Sydney, Australia http://pye.dyndns.org/ |
From: Nils W. <nw...@ia...> - 2006-04-27 07:51:41
|
Hi all, What is the state-of-the-art of making matrix structure plots of sparse matrices with matplotlib ? Nils http://math.nist.gov/MatrixMarket/structureplots.html |
From: Alan J. <al...@aj...> - 2006-04-27 03:25:18
|
I'm working on a little tool using callbacks, so I have it set up so that I can interactively add special points in the plot window. I would also like to delete points. I tried writing a white '+' on top of my original '+' but it looks like the dithering causes the original point to only fade a bit, and not disappear. I tried overwriting circles ('o'), and the interiors disappeared, but I'm left with the border. Any suggestions on how to do this? I thought it was going to be easy! I guess I could just save all the commands and do a redraw, but I'd like to avoid that if I can. -- ----------------------------------------------------------------------- | Alan K. Jackson | To see a World in a Grain of Sand | | al...@aj... | And a Heaven in a Wild Flower, | | www.ajackson.org | Hold Infinity in the palm of your hand | | Houston, Texas | And Eternity in an hour. - Blake | ----------------------------------------------------------------------- |
From: Eric F. <ef...@ha...> - 2006-04-26 23:23:05
|
Glen, The change you ran into is mine. The relevant parameter is in this method of the base Locator class: def nonsingular(self, vmin, vmax, expander=0.001, tiny=1e-6): if vmax < vmin: vmin, vmax = vmax, vmin if vmax - vmin <= max(abs(vmin), abs(vmax)) * tiny: if vmin==0.0: vmin -= 1 vmax += 1 else: vmin -= expander*abs(vmin) vmax += expander*abs(vmax) return vmin, vmax This method gets called in several places. Some of them supply the expander kwarg, but I don't think any supply the tiny kwarg, so the default, which I arbitrarily set to 1e-6, is used. I dimly recall finding that using a *much* smaller value could cause trouble elsewhere. Rather than patching the code you send out, I suggest you consider using a custom Locator, which would allow you to set this parameter to whatever works for you, and maybe put in additional tweaks for your unusual use case. You could subclass whatever Locator you are using now, e.g. class myLocator(MaxNLocator): def nonsingular(self, vmin, vmax, expander=0.001, tiny=1e-12): return Locator.nonsingular(self, vmin, vmax, expander=expander, tiny=tiny) and then ax.xaxis.set_major_locator(myLocator()) This is untested, but I think something along these lines is all you would need. Everything except nonsingular would be inherited, and nonsingular would be called with your new default value for tiny. As an alternative approach, can you simply use as your x-coordinate time deltas from a suitable base time, so that vmin and vmax would not be so huge compared to their difference? My assumption while working with the ticker.py code was that this would be the logical solution to this sort of problem. Longer term, it would be easy to modify the Locator classes so that the default values of tiny and expander would appear as a kwargs in __init__. Whether this would be a valuable change or mere clutter, I don't know; I will listen for more advice. Eric Glen W. Mabey wrote: > Glen W. Mabey wrote: > >>I'm in the process of migrating some software I've written from a >>machine with MPL 0.86.2 on it to another with 0.87.2 . >> >>The app is Qt-based with MPL embedded as a widget. The plot itself uses >>dates on the x-axis. >> >>It appears that the behavior of autoscale_view() changed quite a bit >>somewhere between these two versions. >> >>In my application I create a patches.Rectangle that is 100 seconds wide: >> >> start_time_num = matplotlib.dates.date2num( start_time ) >> lower_left = [ matplotlib.dates.date2num( start_time ), start_y ] >> width = matplotlib.dates.date2num( start_time + datetime.timedelta( seconds=10 ) ) - start_time_num >> r = matplotlib.patches.Rectangle( lower_left, width, height ) >> >>With the 0.86.2 version, the total span of the x-axis after an >>autoscale_view() call is about 12 seconds. For the 0.87.2 version >>however, the span is more than 200 years. (see attached .png files) >> >>I don't see this type of behavior in the pylab environment, yet I'm >>having a hard time creating a concise example that demonstrates the >>behavior. >> >>I can keep working on extracting an snippet, but I thought I'd ask >>if this is some intended behavioral change, and if so, if there is a >>workaround. > > > Okay, I figured out what the critical parameter is: if the width of the > Rectangle is less than one-millionth of the x value, then I get the > centuries of timespan on the x-axis phenomenon. > > (That's probably blindingly obvious in the source code ... somewhere.) > > So, first of all, this behavior has nothing to do with the OO interface, > nor the Qt backend. > > This seems like reasonable behavior for autoscaling in general. > Certainly you can't zoom in nicely around a patch with zero width; > you have to draw the line somewhere. (ha ha, no pun intended) > > It just so happens that for my application, I need to plot Rectangles > that represent events as a function of time and frequency. As such, my > x-values (as produced by date2num()) are on the order of 732421, yet > I need to display patches that are like 10 seconds wide, which turns > out to be 0.000115740695037, after a date2num() conversion. > > This behavior is exhibited in the following lines of code. A delta of > 65000 seconds is sufficient to get the scaling right. > > > ######### > > > import matplotlib > import matplotlib.dates > from matplotlib.pylab import * > > import datetime > > ax = subplot(111) > > start_time = datetime.datetime(2006, 4, 21) > start_time_num = matplotlib.dates.date2num( start_time ) > > lower_left = [ start_time_num, 1.345680002 ] > width = matplotlib.dates.date2num( start_time + datetime.timedelta( seconds=100 ) ) - start_time_num > print 'width = ', width > > ax.add_patch( matplotlib.patches.Rectangle( lower_left, width, 2 ) ) > > ax.autoscale_view() > ax.xaxis.set_major_formatter( matplotlib.dates.DateFormatter('%Y') ) > > print ax.get_xlim() > show() > > > ########## > > So, this seems like a fairly narrow case where the threshold in use > causes a problem. I can't imagine another instance where 1e-6 would not > be prefectly fine. > > One solution would be to just patch the source for my deployment of this > software ... > > I hesitate to suggest that this level ought to be globally tunable by > the user, although an additional parameter that could be passed to > autoscale_view() wouldn't be as bad. Still that seems like clutter. > > What say ye? > > Thank you, > Glen Mabey > > > ------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Glen W. M. <Gle...@sw...> - 2006-04-26 22:36:47
|
Glen W. Mabey wrote: > I'm in the process of migrating some software I've written from a > machine with MPL 0.86.2 on it to another with 0.87.2 . > > The app is Qt-based with MPL embedded as a widget. The plot itself uses > dates on the x-axis. > > It appears that the behavior of autoscale_view() changed quite a bit > somewhere between these two versions. > > In my application I create a patches.Rectangle that is 100 seconds wide: > > start_time_num = matplotlib.dates.date2num( start_time ) > lower_left = [ matplotlib.dates.date2num( start_time ), start_y ] > width = matplotlib.dates.date2num( start_time + datetime.timedelta( seconds=10 ) ) - start_time_num > r = matplotlib.patches.Rectangle( lower_left, width, height ) > > With the 0.86.2 version, the total span of the x-axis after an > autoscale_view() call is about 12 seconds. For the 0.87.2 version > however, the span is more than 200 years. (see attached .png files) > > I don't see this type of behavior in the pylab environment, yet I'm > having a hard time creating a concise example that demonstrates the > behavior. > > I can keep working on extracting an snippet, but I thought I'd ask > if this is some intended behavioral change, and if so, if there is a > workaround. Okay, I figured out what the critical parameter is: if the width of the Rectangle is less than one-millionth of the x value, then I get the centuries of timespan on the x-axis phenomenon. (That's probably blindingly obvious in the source code ... somewhere.) So, first of all, this behavior has nothing to do with the OO interface, nor the Qt backend. This seems like reasonable behavior for autoscaling in general. Certainly you can't zoom in nicely around a patch with zero width; you have to draw the line somewhere. (ha ha, no pun intended) It just so happens that for my application, I need to plot Rectangles that represent events as a function of time and frequency. As such, my x-values (as produced by date2num()) are on the order of 732421, yet I need to display patches that are like 10 seconds wide, which turns out to be 0.000115740695037, after a date2num() conversion. This behavior is exhibited in the following lines of code. A delta of 65000 seconds is sufficient to get the scaling right. ######### import matplotlib import matplotlib.dates from matplotlib.pylab import * import datetime ax = subplot(111) start_time = datetime.datetime(2006, 4, 21) start_time_num = matplotlib.dates.date2num( start_time ) lower_left = [ start_time_num, 1.345680002 ] width = matplotlib.dates.date2num( start_time + datetime.timedelta( seconds=100 ) ) - start_time_num print 'width = ', width ax.add_patch( matplotlib.patches.Rectangle( lower_left, width, 2 ) ) ax.autoscale_view() ax.xaxis.set_major_formatter( matplotlib.dates.DateFormatter('%Y') ) print ax.get_xlim() show() ########## So, this seems like a fairly narrow case where the threshold in use causes a problem. I can't imagine another instance where 1e-6 would not be prefectly fine. One solution would be to just patch the source for my deployment of this software ... I hesitate to suggest that this level ought to be globally tunable by the user, although an additional parameter that could be passed to autoscale_view() wouldn't be as bad. Still that seems like clutter. What say ye? Thank you, Glen Mabey |
From: Jeff W. <js...@fa...> - 2006-04-26 21:06:29
|
Glen W. Mabey wrote: > On Wed, Apr 26, 2006 at 02:32:39PM -0600, Jeff Whitaker wrote: > >> Glen: That works for me - a small window pops up and I see the >> continents and the topo field. I'm using the latest svn matplotlib and >> basemap. >> > > Jeff: > > Could you tell me what versions of Qt and Python you're using? I'm on > Python 2.4.3 with Qt 3.3.3, on AMD x86-64. > > I'll give it a try on Qt 3.3.6 here shortly ... > > Glen > Glen: Python 2.4.3, qt 3.3.5, pyqt 3.15 on macos x ppc (using x11, not aqua). -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
From: Glen W. M. <Gle...@sw...> - 2006-04-26 20:47:56
|
On Wed, Apr 26, 2006 at 02:32:39PM -0600, Jeff Whitaker wrote: > Glen: That works for me - a small window pops up and I see the > continents and the topo field. I'm using the latest svn matplotlib and > basemap. Jeff: Could you tell me what versions of Qt and Python you're using? I'm on Python 2.4.3 with Qt 3.3.3, on AMD x86-64. I'll give it a try on Qt 3.3.6 here shortly ... Glen |
From: Jeff W. <js...@fa...> - 2006-04-26 20:32:44
|
Glen W. Mabey wrote: > On Wed, Apr 26, 2006 at 01:43:30PM -0600, Jeff Whitaker wrote: > >> Glen W. Mabey wrote: >> >>> Hello, >>> >>> I'm trying to follow the basemap examples in using basemap as a >>> matplotlib widget within a Qt-based application. Taking the example >>> code >>> simpletest_oo.py >>> and modifying it to target QtAgg instead, I only get the lat/long lines, >>> as in the attached .png. The original example does draw all of the >>> continent lines and country boundaries correctly on my system. >>> >>> I'm using matplotlib and basemap svn of 25 Apr 2006; the same results >>> were produced with 0.87.2 / 0.8.2 . >>> >>> If anyone can see something obvious that I'm leaving out, I would really >>> appreciate a hint as to why the continents, countries, etc. are not >>> getting drawn. >>> >>> Thank you! >>> Glen Mabey >>> >>> >>> >> Glen: I can't run your example, since I don't have all the dependencies >> (such as mplwidget and justaplot_designer). >> > > Oh, whoops. I thought I had everything in there. Here it is, in a > single file: > > > ....(snipped).... > I think I'm following fairly closely the suggestions posted to this > mailing list regarding the use of OO matplotlib with basemap: passing > the 'ax' to Basemap(). > > Yet, it seems that the call to drawmapboundary() resets the entire axis. > If it is commented out, then everything else works. With it, only the > boundary, parallels, and meridians are shown. > > I'm continuing to look into this ... Thanks for your reply. > > Glen > Glen: That works for me - a small window pops up and I see the continents and the topo field. I'm using the latest svn matplotlib and basemap. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
From: John H. <jdh...@ac...> - 2006-04-26 20:22:13
|
>>>>> "Tom" == Tom Denniston <tom...@al...> writes: Tom> I was able to work around the error simply by doing the Tom> obvious, making var = 0 if max(abs(vmin), abs(vmax)). I Tom> think someone who understood the code better could probably Tom> come up with a better solution. Hey Tom, this bug is already fixed in matplotlib svn. Thanks for the report. JDH |
From: Tom D. <tom...@al...> - 2006-04-26 20:17:52
|
The following code in matplotlib.ticker has a bug: 730 def scale_range(vmin, vmax, n =3D 1, threshold=3D100): 731 dv =3D abs(vmax - vmin) 732 meanv =3D 0.5*(vmax+vmin) 733 B-> var =3D dv/max(abs(vmin), abs(vmax)) 734 if var < 1e-12: 735 return 1.0, 0.0 736 if abs(meanv)/dv < threshold: 737 offset =3D 0 738 elif meanv > 0: When both dmin and dmax are 0 it results in 0 division. I have been unable to write a snippet of code to reproduce the problem unfortunately. I was able to work around the error simply by doing the obvious, making var =3D 0 if max(abs(vmin), abs(vmax)). I think someone who understood the code better could probably come up with a better solution. --Tom |
From: Glen W. M. <Gle...@sw...> - 2006-04-26 20:10:04
|
On Wed, Apr 26, 2006 at 01:43:30PM -0600, Jeff Whitaker wrote: > Glen W. Mabey wrote: > >Hello, > > > >I'm trying to follow the basemap examples in using basemap as a > >matplotlib widget within a Qt-based application. Taking the example > >code > > simpletest_oo.py > >and modifying it to target QtAgg instead, I only get the lat/long lines, > >as in the attached .png. The original example does draw all of the > >continent lines and country boundaries correctly on my system. > > > >I'm using matplotlib and basemap svn of 25 Apr 2006; the same results > >were produced with 0.87.2 / 0.8.2 . > > > >If anyone can see something obvious that I'm leaving out, I would really > >appreciate a hint as to why the continents, countries, etc. are not > >getting drawn. > > > >Thank you! > >Glen Mabey > > > > > > Glen: I can't run your example, since I don't have all the dependencies > (such as mplwidget and justaplot_designer). Oh, whoops. I thought I had everything in there. Here it is, in a single file: ################# import matplotlib matplotlib.use('QtAgg') from matplotlib.backends.backend_qtagg import FigureCanvasQTAgg as FigureCanvas class MatplotlibWidget( FigureCanvas ): """Ultimately, this is a QWidget (as well as a FigureCanvasAgg, etc.).""" def __init__( self, parent=None, name=None ): self.init_parent = parent self.init_name = name if self.init_parent: # slightly more robust behavior here would be to check to make sure parent is a QWidget ... bgc = self.init_parent.backgroundBrush().color() bgcolor = float(bgc.red())/255.0, float(bgc.green())/255.0, float(bgc.blue())/255.0 #bgcolor = "#%02X%02X%02X" % (bgc.red(), bgc.green(), bgc.blue()) Equivalent to above line self.fig = Figure( dpi=100, facecolor=bgcolor, edgecolor=bgcolor ) self.axes = self.fig.add_subplot(111) # We want the axes cleared every time plot() is called self.axes.hold(False) # Apparently the FigureCanvas class has neither a name nor a label attribute. FigureCanvas.__init__(self, self.fig) self.reparent( self.init_parent, qt.QPoint(0, 0)) self.axes.set_label( self.init_name ) self.setMinimumSize( 100, 100 ) self.setSizePolicy( qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding ) self.updateGeometry() import qt class PlotWin( qt.QDialog ): def __init__( self, parent=None, name=None, modal=0, fl=0 ): qt.QDialog.__init__(self,parent,name,modal,fl) Form1Layout = qt.QVBoxLayout(self,11,6,"Form1Layout") self.matplotlibWidget = MatplotlibWidget(self,"matplotlibWidget") Form1Layout.addWidget(self.matplotlibWidget) self.resize(qt.QSize(322,222).expandedTo(self.minimumSizeHint())) self.clearWState(qt.Qt.WState_Polished) from matplotlib.toolkits.basemap import Basemap from matplotlib.figure import Figure from matplotlib.mlab import meshgrid import matplotlib.numerix as nx import matplotlib.cm as cm from matplotlib.mlab import load # read in topo data (on a regular lat/lon grid) # longitudes go from 20 to 380. etopo = nx.array(load('etopo20data.gz'),'d') lons = nx.array(load('etopo20lons.gz'),'d') lats = nx.array(load('etopo20lats.gz'),'d') # create figure. plot_window = PlotWin() # create axes instance, leaving room for colorbar at bottom. ax = plot_window.matplotlibWidget.axes # create Basemap instance for Robinson projection. # set 'ax' keyword so pylab won't be imported. m = Basemap(projection='robin',lon_0=0.5*(lons[0]+lons[-1]),ax=ax) # reset figure size to have same aspect ratio as map. # fig will be 8 inches wide. # (don't use createfigure, since that imports pylab). #fig.set_figsize_inches((8,m.aspect*8.)) # make filled contour plot. x, y = m(*meshgrid(lons, lats)) cs = m.contourf(x,y,etopo,30,cmap=cm.jet) # draw coastlines. m.drawcoastlines() # draw a line around the map region. m.drawmapboundary() # draw parallels and meridians. m.drawparallels(nx.arange(-60.,90.,30.),labels=[1,0,0,0],fontsize=10) m.drawmeridians(nx.arange(0.,420.,60.),labels=[0,0,0,1],fontsize=10) # add a title. ax.set_title('Robinson Projection') # add a colorbar. #cax = fig.add_axes([0.125, 0.05, 0.75, 0.05],frameon=False) #fig.colorbar(cs, cax=cax, tickfmt='%d', orientation='horizontal',clabels=cs.levels[::3]) # save image (width 800 pixels with dpi=100 and fig width 8 inches). plot_window.matplotlibWidget.draw() plot_window.show() plot_window.exec_loop() ##################### If I was more familiar with some of the other GUI backends, I would try a similar setup with them. I think I'm following fairly closely the suggestions posted to this mailing list regarding the use of OO matplotlib with basemap: passing the 'ax' to Basemap(). Yet, it seems that the call to drawmapboundary() resets the entire axis. If it is commented out, then everything else works. With it, only the boundary, parallels, and meridians are shown. I'm continuing to look into this ... Thanks for your reply. Glen |
From: Jeff W. <js...@fa...> - 2006-04-26 19:43:36
|
Glen W. Mabey wrote: > Hello, > > I'm trying to follow the basemap examples in using basemap as a > matplotlib widget within a Qt-based application. Taking the example > code > simpletest_oo.py > and modifying it to target QtAgg instead, I only get the lat/long lines, > as in the attached .png. The original example does draw all of the > continent lines and country boundaries correctly on my system. > > I'm using matplotlib and basemap svn of 25 Apr 2006; the same results > were produced with 0.87.2 / 0.8.2 . > > If anyone can see something obvious that I'm leaving out, I would really > appreciate a hint as to why the continents, countries, etc. are not > getting drawn. > > Thank you! > Glen Mabey > > Glen: I can't run your example, since I don't have all the dependencies (such as mplwidget and justaplot_designer). However, I can run the simpletest.py example using QtAgg and the continents display as expected, so I don't think it is a Qt issue. But, you probably already knew that - sorry I can't be of more help. -Jeff -- Jeffrey S. Whitaker Phone : (303)497-6313 Meteorologist FAX : (303)497-6449 NOAA/OAR/PSD R/PSD1 Email : Jef...@no... 325 Broadway Office : Skaggs Research Cntr 1D-124 Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg |
From: Christopher B. <Chr...@no...> - 2006-04-26 16:21:02
|
Charlie Moad wrote: > On 4/26/06, Christopher Barker <Chr...@no...> wrote: >> Does it support all three numerix packages, TK, gtk, and wx? > > - Yes to all the numerix. > - Yes to Tk. > - I never bother with gtk on mac, and I thought we discussed that > primarily fink/darwin ports people would be gtk users. They have a > separate python. yes, we did, sorry to write that so quick. > - It should work fine with wx, but I didn't compile the _wxagg > extension since there is not a universal wxpython yet. There is a test version now. I'll try what you have done, and then maybe try to build with the new Universal wxPython. > The funny thing is that some of the dependencies on OSX appear to be > PPC only. Zlib is PPC only. Do you mean that there is no zlib on intel Macs? Or that the zlib that you have is a PPC only binary? If the later, then that makes sense. It's a dynamic lib, so it's runtime linked. At runtime, you only need the native one. Presumably Intel macs have an intel native zlib installed. > I guess they all work due to Rosetta, Rosetta is pretty cool, but I don't think it supports mixing intel and PPC libs in one running app. > I am glad to hear at least one > person, Markus, had success with it. If it ain't broke, don't fix it! -thanks for all your work. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |
From: Glen W. M. <Gle...@sw...> - 2006-04-26 15:47:55
|
Hello, I'm trying to follow the basemap examples in using basemap as a matplotlib widget within a Qt-based application. Taking the example code simpletest_oo.py and modifying it to target QtAgg instead, I only get the lat/long lines, as in the attached .png. The original example does draw all of the continent lines and country boundaries correctly on my system. I'm using matplotlib and basemap svn of 25 Apr 2006; the same results were produced with 0.87.2 / 0.8.2 . If anyone can see something obvious that I'm leaving out, I would really appreciate a hint as to why the continents, countries, etc. are not getting drawn. Thank you! Glen Mabey ######## justaplot_designer.py from qt import * from mplwidget import * class Form1(QDialog): def __init__(self,parent = None,name = None,modal = 0,fl = 0): QDialog.__init__(self,parent,name,modal,fl) Form1Layout = QVBoxLayout(self,11,6,"Form1Layout") self.matplotlibWidget = MatplotlibWidget(self,"matplotlibWidget") Form1Layout.addWidget(self.matplotlibWidget) self.resize(QSize(322,222).expandedTo(self.minimumSizeHint())) self.clearWState(Qt.WState_Polished) ######## basemap_simpletest_oo_qt.py ##################################### # pylab-free version of simpletest.py ##################################### # set backend to QtAgg. import matplotlib matplotlib.use('QtAgg') from matplotlib.backends.backend_qt import FigureCanvasQT as FigureCanvas from matplotlib.toolkits.basemap import Basemap from matplotlib.figure import Figure from matplotlib.mlab import meshgrid import matplotlib.numerix as nx import matplotlib.cm as cm from matplotlib.mlab import load import justaplot_designer class PlotWin( justaplot_designer.Form1 ): def __init__(self,parent = None,name = None,modal = 0,fl = 0): justaplot_designer.Form1.__init__( self, parent, name, modal, fl ) # read in topo data (on a regular lat/lon grid) # longitudes go from 20 to 380. etopo = nx.array(load('etopo20data.gz'),'d') lons = nx.array(load('etopo20lons.gz'),'d') lats = nx.array(load('etopo20lats.gz'),'d') # create figure. plot_window = PlotWin() # create axes instance, leaving room for colorbar at bottom. ax = plot_window.matplotlibWidget.axes # create Basemap instance for Robinson projection. # set 'ax' keyword so pylab won't be imported. m = Basemap(projection='robin',lon_0=0.5*(lons[0]+lons[-1]),ax=ax) # reset figure size to have same aspect ratio as map. # fig will be 8 inches wide. # (don't use createfigure, since that imports pylab). #fig.set_figsize_inches((8,m.aspect*8.)) # make filled contour plot. x, y = m(*meshgrid(lons, lats)) cs = m.contourf(x,y,etopo,30,cmap=cm.jet) # draw coastlines. m.drawcoastlines() # draw a line around the map region. m.drawmapboundary() # draw parallels and meridians. m.drawparallels(nx.arange(-60.,90.,30.),labels=[1,0,0,0],fontsize=10) m.drawmeridians(nx.arange(0.,420.,60.),labels=[0,0,0,1],fontsize=10) # add a title. ax.set_title('Robinson Projection') # add a colorbar. #cax = fig.add_axes([0.125, 0.05, 0.75, 0.05],frameon=False) #fig.colorbar(cs, cax=cax, tickfmt='%d', orientation='horizontal',clabels=cs.levels[::3]) # save image (width 800 pixels with dpi=100 and fig width 8 inches). plot_window.matplotlibWidget.draw() plot_window.show() plot_window.exec_loop() |
From: Markus W. <mar...@gm...> - 2006-04-26 13:29:38
|
Hi all, I only tested on my G4, so I am glad to hear at least one > person, Markus, had success with it. I ran some additional tests on it. All the animation stuff in the examples runs just fine and very decent. The pylab mode of ipython also works out of the box with this build. Greetings, Markus |
From: Charlie M. <cw...@gm...> - 2006-04-26 11:45:22
|
On 4/26/06, Christopher Barker <Chr...@no...> wrote: > Charlie Moad wrote: > > Hey all (primarily Chris), > > I took the time to make a universal build that statically links > > universal libpng and freetype builds. It was built against the latest > > pyarrays. I don't know if anyone else got around to this yet. > > I know I hadn't. Thanks! > > Does it support all three numerix packages, TK, gtk, and wx? - Yes to all the numerix. - Yes to Tk. - I never bother with gtk on mac, and I thought we discussed that primarily fink/darwin ports people would be gtk users. They have a separate python. - It should work fine with wx, but I didn't compile the _wxagg extension since there is not a universal wxpython yet. The funny thing is that some of the dependencies on OSX appear to be PPC only. Zlib is PPC only. I didn't look into the tcl/tk framework. I guess they all work due to Rosetta, but I am still unclear on all the details. For example, it appears I successfully linked a universal libpng to that libz which is not universal. In any case, everything provided by my build is universal, so that's the best we can do. I only tested on my G4, so I am glad to hear at least one person, Markus, had success with it. - Charlie |