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
(5) |
2
(24) |
3
(2) |
4
|
5
(4) |
6
(1) |
7
(22) |
8
(9) |
9
(23) |
10
(6) |
11
|
12
(7) |
13
(17) |
14
(12) |
15
(10) |
16
(22) |
17
(11) |
18
(6) |
19
(11) |
20
(13) |
21
(10) |
22
(7) |
23
(7) |
24
(5) |
25
(3) |
26
(20) |
27
(17) |
28
(25) |
29
(16) |
30
(17) |
31
(8) |
From: Richard A. <ral...@in...> - 2007-03-21 20:42:33
|
use tick top: ax = twinx() ax.xaxis.tick_top() On Wed, 2007-03-21 at 18:17 +0100, Matthew Czesarski wrote: > Hi matplotlib-users! > > OK, yeah, I'm pretty new to matplotlib/pylab... I played with biggles > for a short while but, all (more than 3) my python-using associates in > the astronomical community we saying matplotlib was the way of the > future... So I started with matplotlib. > > I would like to plot some points, y vs x on a graph. y containing > simple values, x is an angle. plot(x, y) -- that bit is fine, values > as a function of angle. But what I need to do is then have an another > labelling scheme on the upper x axes. This would be say, a distance, > and so is simply a constant multiplied by the lower x. I figured there > would be some way I could rescale the x-axis and write it at the top, > but a way of accomplishing this I cannot find. > > I have been playing with twinx a bit but not getting very far. It's > not that I want to plot 2 different datasets because the two are > equivalent. Is it the non-existnt twiny() I am looking for? Or is > there simply a way to redraw axes over the current ones with a certain > range, that leaves the range in the first plot untouched? I have > messed with twinx a bit and some of the discussion in the archive for > this list but I can't figure out how to do it... > > Hope that makes sense? Sorry my first post was a beg for help > Matt > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Rick Albright Senior Quantitative Analyst Indie Research, LLC 254 Witherspoon Street Princeton, NJ 08542 (609)497-1030 ral...@in... |
From: John H. <jd...@gm...> - 2007-03-21 20:38:59
|
On 3/21/07, Michael Lerner <mgl...@gm...> wrote: > Hi, > > I want to make a figure that has three subplots. The top one should > be a big, mostly square thing. The bottom two should be rectangular > things. That is, I want it to look like this: > > XXXXX > XXXXX > XXXXX > XXXXX > > XXXXX > XXXXX > > XXXXX > XXXXX > > so, I'm using subplot(311), subplot(312), subplot(313). But, things > are getting resized so that each of the rows has the same height. > That really messes up the aspect ratio for my top row. The following might hrlp: ax1 = subplot(211) ax2 = subplot(413) ax3 = subplot(414) JDH |
From: Michael L. <mgl...@gm...> - 2007-03-21 20:30:44
|
Hi, Sorry if I'm just being thick .. I read through several of the examples, and didn't figure it out. I can figure out how to use figsize to set the size of the entire figure, but I want several subplots on one figure. Maybe you can help me fix some sample code. This plots a matrix and sqrt(x)/2. I'd like to have the matrix show up as a square while sqrt(x)/2 shows up as a rectangle. The call to axis('scaled') makes my matrix show up as square, but I'd like it to be stretched out so that it uses up all of the horizontal space and makes the figure taller. That is, I want row 1 to be taller than row 2. Thanks, -Michael #!/usr/bin/env python from pylab import * subplot(211) mat = array([[1,2,3],[4,5,6],[7,8,9]]) pcolormesh(mat) axis('scaled') subplot(212) dt = 0.001 t = arange(0.0, 10.0, dt) root_t_over_2 = (t/2.0)**0.5 plot(t,root_t_over_2) show() On 3/21/07, Zack <za...@gm...> wrote: > Hi Michael, > > On 21 March 2007, Michael Lerner wrote: > > > so, I'm using subplot(311), subplot(312), subplot(313). But, things > > are getting resized so that each of the rows has the same height. > > That really messes up the aspect ratio for my top row. > > > > I tried axis('equal') and axis('scaled') after making the first > > subplot. I do indeed get a good aspect ratio, but it shrinks things > > to do this, rather than stretching things. I'd really like the top > > row to be taller than the bottom rows. How can I do this? > > See the examples. > > You just have to set figure size you need. > > f = Figure(figsize=(5,4), dpi=100) > > -- > Zack > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > -- Biophysics Graduate Student Carlson Lab, University of Michigan http://www.umich.edu/~mlerner http://lernerclan.net |
From: Zack <za...@gm...> - 2007-03-21 19:05:06
|
Hi Michael, On 21 March 2007, Michael Lerner wrote: > so, I'm using subplot(311), subplot(312), subplot(313). But, things > are getting resized so that each of the rows has the same height. > That really messes up the aspect ratio for my top row. > > I tried axis('equal') and axis('scaled') after making the first > subplot. I do indeed get a good aspect ratio, but it shrinks things > to do this, rather than stretching things. I'd really like the top > row to be taller than the bottom rows. How can I do this? See the examples. You just have to set figure size you need. f = Figure(figsize=(5,4), dpi=100) -- Zack |
From: Michael L. <mgl...@gm...> - 2007-03-21 18:38:47
|
Hi, I want to make a figure that has three subplots. The top one should be a big, mostly square thing. The bottom two should be rectangular things. That is, I want it to look like this: XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX so, I'm using subplot(311), subplot(312), subplot(313). But, things are getting resized so that each of the rows has the same height. That really messes up the aspect ratio for my top row. I tried axis('equal') and axis('scaled') after making the first subplot. I do indeed get a good aspect ratio, but it shrinks things to do this, rather than stretching things. I'd really like the top row to be taller than the bottom rows. How can I do this? If it matters, I make the top box with pcolormesh and the bottom rectangles with plot. Thank you, -michael -- Biophysics Graduate Student Carlson Lab, University of Michigan http://www.umich.edu/~mlerner http://lernerclan.net |
From: Matthew C. <mat...@gm...> - 2007-03-21 17:18:13
|
Hi matplotlib-users! OK, yeah, I'm pretty new to matplotlib/pylab... I played with biggles for a short while but, all (more than 3) my python-using associates in the astronomical community we saying matplotlib was the way of the future... So I started with matplotlib. I would like to plot some points, y vs x on a graph. y containing simple values, x is an angle. plot(x, y) -- that bit is fine, values as a function of angle. But what I need to do is then have an another labelling scheme on the upper x axes. This would be say, a distance, and so is simply a constant multiplied by the lower x. I figured there would be some way I could rescale the x-axis and write it at the top, but a way of accomplishing this I cannot find. I have been playing with twinx a bit but not getting very far. It's not that I want to plot 2 different datasets because the two are equivalent. Is it the non-existnt twiny() I am looking for? Or is there simply a way to redraw axes over the current ones with a certain range, that leaves the range in the first plot untouched? I have messed with twinx a bit and some of the discussion in the archive for this list but I can't figure out how to do it... Hope that makes sense? Sorry my first post was a beg for help Matt |
From: Werner H. <wer...@gm...> - 2007-03-21 07:55:35
|
Hi Simson, On Wednesday 21 March 2007 02:59, Simson Garfinkel wrote: > Thanks for the information. Unfortunately, this CDF doesn't look like > the CDF that we see in other published papers. I'm not sure what they > are done with... But they have a thin line that shows the integral > of all measurements, rather than a bar graph. The problem with a bar > graph is that different bin widths give different results. > > GNU Plot seems to do a decent job, as can e seen at http:// > chem.skku.ac.kr/~wkpark/tutor/gnuplot/gpdocs/prob.htm. But there > should be a way to do this nicely with matplotlib, right? Try this one: x = sin(arange(0,100,0.1)) ## your function ## plot the sorted value of your function against ## a linear vektor from 0 to 1 with the same length plot(sort(x), arange(len(x))/float(len(x))) Regrads Werner |
From: John H. <jd...@gm...> - 2007-03-21 02:58:32
|
On 3/20/07, Simson Garfinkel <si...@ac...> wrote: > Thanks for the information. Unfortunately, this CDF doesn't look like > the CDF that we see in other published papers. I'm not sure what they > are done with... But they have a thin line that shows the integral > of all measurements, rather than a bar graph. The problem with a bar > graph is that different bin widths give different results. > > GNU Plot seems to do a decent job, as can e seen at http:// > chem.skku.ac.kr/~wkpark/tutor/gnuplot/gpdocs/prob.htm. But there > should be a way to do this nicely with matplotlib, right? Just replace ax.bar(bins, p) with ax.plot(bins, b) in the example code I posted previously... JDH |
From: Simson G. <si...@ac...> - 2007-03-21 02:00:18
|
Thanks for the information. Unfortunately, this CDF doesn't look like the CDF that we see in other published papers. I'm not sure what they are done with... But they have a thin line that shows the integral of all measurements, rather than a bar graph. The problem with a bar graph is that different bin widths give different results. GNU Plot seems to do a decent job, as can e seen at http:// chem.skku.ac.kr/~wkpark/tutor/gnuplot/gpdocs/prob.htm. But there should be a way to do this nicely with matplotlib, right? On Mar 18, 2007, at 12:41 PM, John Hunter wrote: > On 3/17/07, Simson Garfinkel <si...@ac...> wrote: >> Hi. I haven't been active for a while, but now I have another paper >> that I need to get out... > > Glad to have you back... > >> Anyway, I need to draw a cumulative distribution function, as the >> reviewers of my last paper really nailed me to the wall for including >> histograms instead of CDFs. Is there any way to plot a CDF with >> matplotlib? > > For analytic cdfs, see scipy.stats. I assume you need an empirical > cdf. You can use matplotlib.mlab.hist to compute the empirical pdf > (use normed=True to return a PDF rather than a frequency count). Then > use numpy.cumsum to do the cumulative sum of the pdf, multiplying by > the binsize so it approximates the integral. > > import matplotlib.mlab > from pylab import figure, show, nx > > x = nx.mlab.randn(10000) > p,bins = matplotlib.mlab.hist(x, 50, normed=True) > db = bins[1]-bins[0] > cdf = nx.cumsum(p*db) > > fig = figure() > ax = fig.add_subplot(111) > ax.bar(bins, cdf, width=0.8*db) > show() > |
From: Eric F. <ef...@ha...> - 2007-03-20 20:26:46
|
Pellegrini Eric wrote: > Hi everybody, > > when repeating the following sequence: > > pylab.figure() > pylab.close() > > the memory used increases like if something remained. Would you have any > idea of what is going on ? How to solve this kind of memory leak ? I have confirmed this with svn on linux (default backend, GtkAgg) using the attached script. We are losing about 17k per loop. The usual memory leak checker still indicates that things are OK. The difference appears to be the backend. The attached script with Agg instead of GtkAgg is OK; but with TkAgg it also leaks. It looks like there is something in the interactive backend setup that is not getting cleaned up by close(). Thanks for pointing it out. Eric |
From: Pellegrini E. <eri...@ya...> - 2007-03-20 19:09:11
|
Hi everybody, when repeating the following sequence: pylab.figure() pylab.close() the memory used increases like if something remained. Would you have any idea of what is going on ? How to solve this kind of memory leak ? thank you very much Eruc --------------------------------- Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses. |
From: Pellegrini E. <eri...@ya...> - 2007-03-20 16:20:21
|
Hi, I have a problem of memory leak using the following code: ******************************************************************************** from Tkinter import * from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg import pylab def display(): mat = pylab.zeros((100,100)) pylab.ioff() image = pylab.matshow(mat) pylab.ion() pylab.close() can = FigureCanvasTkAgg(image, master=frame) can.show() can.get_tk_widget().grid(row = 0,column = 0) root = Tk() frame = Frame(root) frame.grid(row = 0,column = 0) canvas = Canvas(frame, width = 240, height = 240, relief = "sunken", bg = "white") canvas.grid() button = Button(root,text="DisplayMatrix",command = display) button.grid(row = 1,column = 0) ******************************************************************************* would you have any idea of what is going wrong ? Thank you very much Eric --------------------------------- Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses. |
From: Steve S. <el...@gm...> - 2007-03-20 15:33:26
|
Ana Paula Leite wrote: > Dear all, > > I have a list with about 300 elements like the following: > listNames = ['name1', 'name2', 'name3', ...] > > I want to iterate through this list, creating several figures where each > one will include two subplots. > The problem is that I want to label each figure like in the following > example: > > 'name1_name2.png' > > How do I concatenate those names in the savefig() function? > How about name = "%s_%s.png" %(listNames[0], listNames[1]) savegig(name) or name = listNames[0] + "_" + listNames[1] + ".png" -- cheers, steve Random number generation is the art of producing pure gibberish as quickly as possible. |
From: Ana P. L. <apo...@gm...> - 2007-03-20 15:31:32
|
It's just as simple as: savefig('name1'+'_'+'name2') |
From: Ana P. L. <apo...@gm...> - 2007-03-20 15:17:56
|
Dear all, I have a list with about 300 elements like the following: listNames = ['name1', 'name2', 'name3', ...] I want to iterate through this list, creating several figures where each one will include two subplots. The problem is that I want to label each figure like in the following example: 'name1_name2.png' How do I concatenate those names in the savefig() function? Thanks, Ana |
From: Ryan K. <rya...@gm...> - 2007-03-20 13:49:36
|
Thanks John. That will work. Ryan On 3/20/07, John Hunter <jd...@gm...> wrote: > On 3/20/07, Ryan Krauss <rya...@gm...> wrote: > > I have a figure with 2 subplots (2 rows, 1 column) created using the > > OO interface like this: > > > > ax1=fig.add_subplot(2,1,1) > > ax2=fig.add_subplot(2,1,2) > > > > After I have created these axes and plotted things on them, I want to > > be able to set their x and y lims. The function that creates the plot > > returns fig. I can then get to a list of the axes from fig.axes. My > > question is this: can I know from the list of axes or their individual > > properties which one is which - i.e. which one is the top one and > > which one is the bottom one? It looks like ax1.rowNum and colNum > > should refer to the parameters I want (rowNum in this case, since > > there is only one column). But there isn't a docstring for them. Is > > this there intended use (or at least a safe use of them)? > > > > 99% of the time, I will create the top one first so topfig=fig.axes[0] > > and bottomfig=fig.axes[1]. But if I ever screw that up, it could be > > bad. > > > If you are creating subplots, you can do > > rows, cols, num = ax.get_geometry() > > You can also change the geometry with set_geometry. > > There are a couple of Subplot helper functions you may find useful, eg > to selectively apply x and ylabeling: > > def is_first_col(self): > return self.colNum==0 > > def is_first_row(self): > return self.rowNum==0 > > def is_last_row(self): > return self.rowNum==self.numRows-1 > > def is_last_col(self): > return self.colNum==self.numCols-1 > |
From: John H. <jd...@gm...> - 2007-03-20 13:35:59
|
On 3/20/07, Ryan Krauss <rya...@gm...> wrote: > I have a figure with 2 subplots (2 rows, 1 column) created using the > OO interface like this: > > ax1=fig.add_subplot(2,1,1) > ax2=fig.add_subplot(2,1,2) > > After I have created these axes and plotted things on them, I want to > be able to set their x and y lims. The function that creates the plot > returns fig. I can then get to a list of the axes from fig.axes. My > question is this: can I know from the list of axes or their individual > properties which one is which - i.e. which one is the top one and > which one is the bottom one? It looks like ax1.rowNum and colNum > should refer to the parameters I want (rowNum in this case, since > there is only one column). But there isn't a docstring for them. Is > this there intended use (or at least a safe use of them)? > > 99% of the time, I will create the top one first so topfig=fig.axes[0] > and bottomfig=fig.axes[1]. But if I ever screw that up, it could be > bad. If you are creating subplots, you can do rows, cols, num = ax.get_geometry() You can also change the geometry with set_geometry. There are a couple of Subplot helper functions you may find useful, eg to selectively apply x and ylabeling: def is_first_col(self): return self.colNum==0 def is_first_row(self): return self.rowNum==0 def is_last_row(self): return self.rowNum==self.numRows-1 def is_last_col(self): return self.colNum==self.numCols-1 |
From: Ryan K. <rya...@gm...> - 2007-03-20 12:59:20
|
I have a figure with 2 subplots (2 rows, 1 column) created using the OO interface like this: ax1=fig.add_subplot(2,1,1) ax2=fig.add_subplot(2,1,2) After I have created these axes and plotted things on them, I want to be able to set their x and y lims. The function that creates the plot returns fig. I can then get to a list of the axes from fig.axes. My question is this: can I know from the list of axes or their individual properties which one is which - i.e. which one is the top one and which one is the bottom one? It looks like ax1.rowNum and colNum should refer to the parameters I want (rowNum in this case, since there is only one column). But there isn't a docstring for them. Is this there intended use (or at least a safe use of them)? 99% of the time, I will create the top one first so topfig=fig.axes[0] and bottomfig=fig.axes[1]. But if I ever screw that up, it could be bad. Thanks, Ryan |
From: David S. <dav...@me...> - 2007-03-20 12:38:40
|
Hi! I'm trying to do a few plots in one figure using subplot, but the size of the legends isn't changing as I try to add more plots. I have found out how to change the size the hard-coded way, but is there any way I can get the legend to know how large it should be? For example, with the following test code the legend is fine with 2 rows of figures, but massive for 5 rows: y=([ 1.2, 2.3, 3.4, 2.2 ]) z=([ 2.2, 2.6, 1.4, 1.2 ]) a1=subplot(541) plot( y, label='TESTY' ) a1.legend() a2=subplot(542) plot( z, label='TESTZ' ) a2.legend() show() Thanks for any tips, Dave ~ |
From: Fernando P. <fpe...@gm...> - 2007-03-20 06:52:42
|
On 3/19/07, Eric Firing <ef...@ha...> wrote: > One of the matshow anomalies is that it is a pylab function only instead > of a wrapper for an Axes method, so I made a new Axes.matshow(), and a > temporary matshow1() pylab function that calls it. Differences between > matshow() and matshow1(): > > 1) The latter labels the *centers* of the squares representing the > matrix elements, starting from zero. Tick values are consequently integers. > > 2) matshow1 uses the same function as matshow (figaspect()) to determine > the window dimensions, but keeps the matrix elements square when they > would be stretched in matshow. I can change this back to the matshow > behavior if desired. Sounds good to me. > > All I need regularly in my work is the ability to plot a matrix such > > that both the axis AND the enclosing figure (which determines the size > > of the resulting EPS files for publications or talks) have the aspect > > ratio of the actual matrix. How that result is achieved is really > > immaterial to me. > > I suspect that what you would actually prefer is better automated figure > sizing so that it would always nicely enclose the axes with their > labels, titles, etc., correct? There is nothing magic about having the > actual aspect ratio of the figure exactly match that of the axes box? > (Not that I can easily achieve the nice wrapping result--this is just to > clarify the ideal.) Yes. In fact, others have pointed the annoying mis-feature of old-matshow where the figure is squeezed if you add for example a colorbar. > > matshow does what I need so I use it, but I have no particular > > attachment to the code other than the fact that it happens to work > > correctly. That's a bonus in my book. > > Absolutely! > > Another anomaly of matshow (presently preserved in matshow1) is the > returnall kwarg; this seems like the sort of thing that should either be > supported by all pylab functions, or by none. The argument for none is > that one can easily use gcf() and gca() to get the other two arguments. > Do you want to keep the returnall kwarg? I honestly don't remember clearly why that was put in. John and I had some brief discussion about it, but in practice I don't think I've ever actually used it. So follow your judgment on this one, I have no opinion. Keep in mind that I wrote matshow() strictly as a quick hack to get some functionality I needed badly (properly scaled display of matrices with labeling along the top/left like 'normal' matrices). I knew so little about the internals of mpl that it's no surprise the code has problems, so by all means feel free to improve it and modify it so it actually fits better with the overall architecture. I'm sure we'll all benefit from such a cleanup. Cheers, f |
From: lazardo <mas...@ya...> - 2007-03-20 02:08:56
|
I'm curious .. how can we include a scrollbar with a subplot, instead of the back and front arrows to view the subplot. Googling matplotlib+scrollbar+subplot brings up a very few results, so I guess it hasn't been attempted before. Any ideas ? Thanx. iyer --------------------------------- Finding fabulous fares is fun. Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains. |
From: Ryan K. <rya...@gm...> - 2007-03-20 00:15:30
|
Thanks to Ken and John, I think I am off and running. Nice work on wxmpl Ken! I think it fills a significant need. The two attached files show a ridiculously simple example of what I am planning to do. It may be completely obvoius to others. test_plot.py is an example of a module that can be used from the command line with pylab and IPython and it can also be imported into a WX app (as demonstrated by wx_compatible.py). So, I will edit my data processing scripts to use this approach. Thanks again, Ryan On 3/19/07, Ryan Krauss <rya...@gm...> wrote: > Sorry, I just googled wxmpl and found your page and am now downloading > it. I may have a more intelligent question momentarily. You may > ignore that part of my response. > > Ryan > > On 3/19/07, Ryan Krauss <rya...@gm...> wrote: > > Thanks for your thoughts Ken. Sorry, I assumed a bit on the context > > of my comments. I have some data processing utility scripts and I > > want to now use with a WX application. The problem is that the > > utility modules were written without any thought of this future use in > > mind and in all of them I have something like > > > > from pylab import figure, cla, clf, plot, semiliogx, show, ... > > > > at the top. This makes them completely incompatible with embedding in > > a WX application. So, I need to re-write them and I want to know how > > to do that best. John had some suggestions and I had some new > > questions as I tried to act on his thoughts. So, the actual plotting > > functions don't have to be re-useable in both contexts, but it would > > be nice. > > > > I can't actually run your code because I don't have the wxmpl.py > > module. Looking at it, it looks like a really nice set of functions > > that work cleanly with embedding in a backend. How could I call one > > of the functions from the command line? Could I do something like: > > import plotting, pylab > > myfig = pylab.figure() > > plotting.plot_simple(myfig) > > > > and would I need any additional commands to actually show the figure? > > > > Let me know if that makes sense and please send me the wxmpl.py file > > or let me know where I can get it. > > > > Thanks again, > > > > Ryan > > > > On 3/19/07, Ken McIvor <mc...@ii...> wrote: > > > Ryan, > > > > > > In my (limited) experience, it's dicey to mix pylab's plotting > > > functionality and the OO API. I guess I'm a little unclear exactly > > > what your use case is for this. It sounds like you're goal is to > > > create a library of functions that operate on Figure instances, > > > perhaps so you can use them both interactively and as part of a > > > wxPython application. > > > > > > If that's the case, I'd recommend you try using pylab's gcf() and draw > > > () to acquire and redraw the current Figure instance from within > > > IPython. You can also save the return value of pylab's figure(), > > > which returns a Figure that's already been attached to the > > > appropriate renderer. This way you can use the OO API for plotting > > > without having to futz with the drawing machinery directly. > > > > > > This script might give you some ideas about how to structure your > > > code. It contains several of the MPL examples re-coded as functions > > > that accept a Figure instance and use the OO API for plotting. > > > > > > http://svn.csrri.iit.edu/mr-software/wxmpl/trunk/demos/plotting.py > > > > > > Ken > > > > > > |
From: Ryan K. <rya...@gm...> - 2007-03-19 23:04:37
|
Sorry, I just googled wxmpl and found your page and am now downloading it. I may have a more intelligent question momentarily. You may ignore that part of my response. Ryan On 3/19/07, Ryan Krauss <rya...@gm...> wrote: > Thanks for your thoughts Ken. Sorry, I assumed a bit on the context > of my comments. I have some data processing utility scripts and I > want to now use with a WX application. The problem is that the > utility modules were written without any thought of this future use in > mind and in all of them I have something like > > from pylab import figure, cla, clf, plot, semiliogx, show, ... > > at the top. This makes them completely incompatible with embedding in > a WX application. So, I need to re-write them and I want to know how > to do that best. John had some suggestions and I had some new > questions as I tried to act on his thoughts. So, the actual plotting > functions don't have to be re-useable in both contexts, but it would > be nice. > > I can't actually run your code because I don't have the wxmpl.py > module. Looking at it, it looks like a really nice set of functions > that work cleanly with embedding in a backend. How could I call one > of the functions from the command line? Could I do something like: > import plotting, pylab > myfig = pylab.figure() > plotting.plot_simple(myfig) > > and would I need any additional commands to actually show the figure? > > Let me know if that makes sense and please send me the wxmpl.py file > or let me know where I can get it. > > Thanks again, > > Ryan > > On 3/19/07, Ken McIvor <mc...@ii...> wrote: > > Ryan, > > > > In my (limited) experience, it's dicey to mix pylab's plotting > > functionality and the OO API. I guess I'm a little unclear exactly > > what your use case is for this. It sounds like you're goal is to > > create a library of functions that operate on Figure instances, > > perhaps so you can use them both interactively and as part of a > > wxPython application. > > > > If that's the case, I'd recommend you try using pylab's gcf() and draw > > () to acquire and redraw the current Figure instance from within > > IPython. You can also save the return value of pylab's figure(), > > which returns a Figure that's already been attached to the > > appropriate renderer. This way you can use the OO API for plotting > > without having to futz with the drawing machinery directly. > > > > This script might give you some ideas about how to structure your > > code. It contains several of the MPL examples re-coded as functions > > that accept a Figure instance and use the OO API for plotting. > > > > http://svn.csrri.iit.edu/mr-software/wxmpl/trunk/demos/plotting.py > > > > Ken > > > |
From: Ken M. <mc...@ii...> - 2007-03-19 20:57:55
|
Ryan, In my (limited) experience, it's dicey to mix pylab's plotting functionality and the OO API. I guess I'm a little unclear exactly what your use case is for this. It sounds like you're goal is to create a library of functions that operate on Figure instances, perhaps so you can use them both interactively and as part of a wxPython application. If that's the case, I'd recommend you try using pylab's gcf() and draw () to acquire and redraw the current Figure instance from within IPython. You can also save the return value of pylab's figure(), which returns a Figure that's already been attached to the appropriate renderer. This way you can use the OO API for plotting without having to futz with the drawing machinery directly. This script might give you some ideas about how to structure your code. It contains several of the MPL examples re-coded as functions that accept a Figure instance and use the OO API for plotting. http://svn.csrri.iit.edu/mr-software/wxmpl/trunk/demos/plotting.py Ken |
From: Ryan K. <rya...@gm...> - 2007-03-19 19:58:09
|
I am learning the hard way that I don't know as much about matplotlib as I thought I did except for how to use pylab. I think I have managed to create a figure, add an axis, and plot something on it without pylab, but I don't know how to do the equivalent of show(). draw() needs a renderder and I can't seem to figure out how to create one. Here is what I have done so far: myfig = pylab.Figure() myaxes=myfig.add_axes((0,1,0,1)) t=arange(0,1,0.01) y=sin(2*pi*t) myaxes.plot(t,y) What do I need to do to show the plot from the command line in IPython (i.e. if I actually want to use pylab instead of OO)? I may be going about this the wrong way and it may be easier just to set up some imports of pylab that only trigger inside of functions, but I would like to have functions that are useful either from the IPython command line or in OOP situations. Following the examples for WX, I am doing this at the top of my OOP modules: from matplotlib.backends.backend_wxagg import Toolbar, FigureCanvasWxAgg from matplotlib.figure import Figure . . . class mplpanel(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent, -1) self.fig = Figure((5,5), 75) self.canvas = FigureCanvasWxAgg(self, -1, self.fig) And the my drawing commands operate on self.fig and then the last line of all plotting functions is self.canvas.draw(). So, it would be nice if my utility functions took a figure instance as an input and operated on it. Am I making any sense? Am I going about this revision in a good way? Thanks, Ryan On 3/15/07, Ryan Krauss <rya...@gm...> wrote: > Thanks John. I know I have some clean up to do, I just want to do it > right so it isn't an annual (or more often) thing.... > > On 3/15/07, John Hunter <jd...@gm...> wrote: > > On 3/15/07, Ryan Krauss <rya...@gm...> wrote: > > > > > How should I be using matplotlib/pylab in my utility scripts so that > > > they are compatible with embedding in wx? > > > > A good rule of thumb is to never import pylab at the top level for > > modules that need to be imported. In my own code, I often do > > something like > > > > def somefunc(figfunc): > > fig = figfunc() > > ax = fig.add_subplot(111) > > ax.plot([1,2,3]) > > > > and then I can call it with > > > > somefunc(pylab.figure) > > > > or a custom func that generates a GUI embedded figure instance. Eg, > > in my GTKApps, I have a functor like gtk_figure that returns a > > function that creates a figure embedded in a GTK window. > > > > In basemap, Jeffrey Whitaker does something like the following > > > > def somefunc(ax=None): > > if ax is None: > > import pylab > > ax = pylab.gca() > > > > Here the pylab import is triggered only when the function is called > > with default arguments. That way you can use it from GUI code without > > triggering a pylab import like > > > > somefunc(ax) > > > > and from other code where you want pylab do do everything with > > > > somefunc() > > > > I'm afraid you have some cleanup to do..... Mixing pylab with > > embedded GUI code is a recipe for pain and misery. > > > > JDH > > > |