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
(13) |
2
(3) |
3
(4) |
4
(24) |
5
(12) |
6
(11) |
7
(14) |
8
(17) |
9
(3) |
10
(5) |
11
(23) |
12
(7) |
13
(9) |
14
(17) |
15
(1) |
16
(2) |
17
(2) |
18
(11) |
19
(14) |
20
(9) |
21
(13) |
22
(12) |
23
(1) |
24
|
25
(7) |
26
(11) |
27
(20) |
28
(19) |
29
(11) |
30
(1) |
I would also highly recommend Ken McIvor's wxmpl: http://agni.phys.iit.edu/~kmcivor/wxmpl/ It makes wxPython and mpl play very nicely together. I have been involved in several threads recently about how no to import pylab in data analysis libraries and when embedding in gui's. You may find this thread useful: http://www.mail-archive.com/mat...@li.../msg02732.html Ryan On 6/22/07, John Hunter <jd...@gm...> wrote: > On 6/22/07, Paul Smith <pau...@ca...> wrote: > > I've converted an analysis program that does some plotting to use the > > matplotlib API, then wrote a GUI control program using wxWidgets to call it. > > I've tried to keep the two parts as separate as possible so there is an > > analysis class that is instantiated in the GUI part, and then the GUI part > > just calls the analysis methods. > > > Ok, so under ipython -pylab everything seems to (mostly) go ok. The GUI > > This appears to be your problem. If you are using mpl in a wx app, > you should not be importing pylab or running ipython in pylab mode > because you will get mainloop conflicts. Rather, use the matplotlib > API directly following the lead of examples/embedding_in_wx*.py and > tthen run ipython in -wthread mode rather than pylab mode. > > JDH > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
On 6/22/07, Roman Bertle <be...@sm...> wrote: > very nice! The only remaining problem is that an analysis library > functions might return several figures. In my case the data depends on > several parameters, and the function returns a dictionary containing for each > parameter set statistics, histograms and plots. The user should be able > to decide for which parameter he wants to pop up a plot, or save it to a > file, but for your approach all these windows pop up automatically, and > not only when the user does a fig.show() for the figure he is interested > in. Unfortunately the latter does not work if the figure is an > matplotlib.figure.Figure() instance, as in my approach. I agree with everything you say, only it is difficult to encapsulate and get the details right for raising and hiding GUI windows across backends, handling the mainloop etc. Not at all impossible, but it takes a concerted effort across 5 user interfaces. Note I did recently (in svn) add a fig.show() method, which will show new figures created in an event loop after the global show starts the GUI mainloop. I do something similar to Ryan, but slightly more general to handle the case you mention -- the need to possibly create multiple figures. I define a figure generating function in my GUI code, and pass either that function, or pylab.figure -- not pylab.figure() -- into my functions that need to create figures. Client code can then call that function as often as they wish to create multiple figure windows. I've included below a class which is callable that is used to generate GTK figures that I sometimes use in my gtk apps. That way functions I use in my apps can also be called from pylab by passing in pylab.figure But as above, I would be very happy to have a finer degree of control in pylab. If you would like to take a stab at a patch to your backend of choice to support better control of figure raising and hiding from the pylab interface, give it a whirl. It would make it easier for other backend maintainers to follow your lead and port the code into the various backends. class GTKFigure: def __init__(self, title): self.title = title def __call__(self): from matplotlib.figure import Figure from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar win = gtk.Window() win.set_default_size(800,600) win.set_title(self.title) vbox = gtk.VBox() win.add(vbox) fig = Figure(figsize=(5,4), dpi=80) canvas = FigureCanvas(fig) # a gtk.DrawingArea vbox.pack_start(canvas) toolbar = NavigationToolbar(canvas, win) vbox.pack_start(toolbar, False, False) win.show_all() return fig
On 6/22/07, Paul Smith <pau...@ca...> wrote: > I've converted an analysis program that does some plotting to use the > matplotlib API, then wrote a GUI control program using wxWidgets to call it. > I've tried to keep the two parts as separate as possible so there is an > analysis class that is instantiated in the GUI part, and then the GUI part > just calls the analysis methods. > Ok, so under ipython -pylab everything seems to (mostly) go ok. The GUI This appears to be your problem. If you are using mpl in a wx app, you should not be importing pylab or running ipython in pylab mode because you will get mainloop conflicts. Rather, use the matplotlib API directly following the lead of examples/embedding_in_wx*.py and tthen run ipython in -wthread mode rather than pylab mode. JDH
Hi Paul, Paul Smith wrote: > > I’ve converted an analysis program that does some plotting to use the > matplotlib API, then wrote a GUI control program using wxWidgets to > call it. I’ve tried to keep the two parts as separate as possible so > there is an analysis class that is instantiated in the GUI part, and > then the GUI part just calls the analysis methods. > > Ok, so under ipython -pylab everything seems to (mostly) go ok. The > GUI comes up, data gets loaded into the analysis object, processed and > plotted in a couple of separate matplotlib windows (ie. ones that are > not specifically part of the GUI), and results come back to update > some wx textctrl fields on the GUI. I qualify this as mostly ok > because if I use the TkAgg backend for the plotting, which is done by > the analysis class, the whole lot crashes to non-existence as soon as > either plot window is moved (yep, this is Windows). If I use the wxAgg > backend, however, it seems to play nice(r). > I think this is due to using TkAgg with wxPython, IIRC TK and WX don't "like" to work together, I think there is some conflict but don't remember the details. > > The problem is when all this is done outside of ipython – ie. running > from the command line ala "python myAnalysisUI.py" - the matplotlib > figures come up when required but text fields are no longer updated in > the GUI once plotting is done. The GUI is still responsive to clicks > on buttons etc, but it’s as if the final bit after plotting gets blocked. > > This makes me wonder about a couple of things. How well do essentially > independent matplotlib windows work with a wx App? > What do you call an independent window? Is this a wx.Frame which shows the matplotlib plots? Do have a smallish sample which shows the problem? ... > > The other vitals are: OS: WinXP, Python 2.5, matplotlib 0.90.1, > wxPython 2.8.0.1, ipython 0.8.2 > I have just about the same, WinXP / Vista, Python 2.5.1, matplotlib 0.90.1 wxPython 2.8.4.0 (but have used older versions too). Werner
* Ryan Krauss <rya...@gm...> [070622 09:47]: > I don't think we are actually disagreeing with one another. I have > written the kind of library you are talking about and used the same > library from ipython and in a wxpython app. All of my plotting > functions expect a fig instance as an input. When calling the library > from ipython, I pass in a fig=pylab.figure(), when using the data > analysis library with wxpython, my fig comes from the get_figure > method of a wxmpl PlotPanel instance. wxmpl handles all canvas issues > for me. > > So, in my libraries, I have inputs that are fig instances. Creating a > fig with pylab.figure() is how I use my library from ipython. > > I actually have this code in one of my data analysis library functions > > def plotting_function(x, y, other inputs, fig=None): > if fig is None: > from pylab import figure > fig = figure(fignum) > > and the code works beautifully as a library and plays well with > ipython and wxpython. Hello, very nice! The only remaining problem is that an analysis library functions might return several figures. In my case the data depends on several parameters, and the function returns a dictionary containing for each parameter set statistics, histograms and plots. The user should be able to decide for which parameter he wants to pop up a plot, or save it to a file, but for your approach all these windows pop up automatically, and not only when the user does a fig.show() for the figure he is interested in. Unfortunately the latter does not work if the figure is an matplotlib.figure.Figure() instance, as in my approach. Best Regards, Roman
I've converted an analysis program that does some plotting to use the matplotlib API, then wrote a GUI control program using wxWidgets to call it. I've tried to keep the two parts as separate as possible so there is an analysis class that is instantiated in the GUI part, and then the GUI part just calls the analysis methods. Ok, so under ipython -pylab everything seems to (mostly) go ok. The GUI comes up, data gets loaded into the analysis object, processed and plotted in a couple of separate matplotlib windows (ie. ones that are not specifically part of the GUI), and results come back to update some wx textctrl fields on the GUI. I qualify this as mostly ok because if I use the TkAgg backend for the plotting, which is done by the analysis class, the whole lot crashes to non-existence as soon as either plot window is moved (yep, this is Windows). If I use the wxAgg backend, however, it seems to play nice(r). The problem is when all this is done outside of ipython - ie. running from the command line ala "python myAnalysisUI.py" - the matplotlib figures come up when required but text fields are no longer updated in the GUI once plotting is done. The GUI is still responsive to clicks on buttons etc, but it's as if the final bit after plotting gets blocked. This makes me wonder about a couple of things. How well do essentially independent matplotlib windows work with a wx App? The fact one backend works (wxAgg) and one doesn't (TkAgg) is a bit strange. Should I be doing something related to threads, which is where maybe ipython is doing a better job, to finish what needs doing in the GUI once plotting has finished? Haven't done anything involving threading so far so I'm guessing here. I should add I do import a few things from pylab - figure, show, twinx. I gather pylab and wx don't mix well. A Minor Detail: wxAgg backend plots by default are missing the left and right navigation button bitmaps in the toolbar which looks a bit funny to me. Only when you pan/zoom do they start to appear. I made the following change to my local copy of backend_wx.py so they'd always appear, if anyone's interested. Doesn't seem to be bothered when clicking arrows if there's no history. def set_history_buttons(self): ## can_backward = (self._views._pos > 0) ## can_forward = (self._views._pos < len(self._views._elements) - 1) ## self.EnableTool(self._NTB2_BACK, can_backward) ## self.EnableTool(self._NTB2_FORWARD, can_forward) self.EnableTool(self._NTB2_BACK, True) self.EnableTool(self._NTB2_FORWARD, True) The other vitals are: OS: WinXP, Python 2.5, matplotlib 0.90.1, wxPython 2.8.0.1, ipython 0.8.2 Paul Smith Systems Engineer CAT Underground Mining Technology Ph: +61 (0)3 9853 4050 Fax: +61 (0)3 9853 4955
On Thursday 21 June 2007 17:15:01 Eric Firing wrote: > trans = blend_xy_sep_transform( self.transData, self.transAxes ) > > where "self" in this case is the axes instance, so you would use "ax" or > whatever. Then, since the collection is an artist, you can use its > inherited set_transform(trans) method, John, Eric, That works like a charm ! Thanks a lot !
I don't think we are actually disagreeing with one another. I have written the kind of library you are talking about and used the same library from ipython and in a wxpython app. All of my plotting functions expect a fig instance as an input. When calling the library from ipython, I pass in a fig=pylab.figure(), when using the data analysis library with wxpython, my fig comes from the get_figure method of a wxmpl PlotPanel instance. wxmpl handles all canvas issues for me. So, in my libraries, I have inputs that are fig instances. Creating a fig with pylab.figure() is how I use my library from ipython. I actually have this code in one of my data analysis library functions def plotting_function(x, y, other inputs, fig=None): if fig is None: from pylab import figure fig = figure(fignum) and the code works beautifully as a library and plays well with ipython and wxpython. Ryan On 6/21/07, Roman Bertle <be...@sm...> wrote: > Hello, > > thank you very much for you answer. The oddness clears if you consider > that the generating of the figure might be done in an external library. > Imagine a data analyze package with functions with can also generate one > or more plots. As a library I think here the OO interface is most > appropriate. A user of such a library might want to plot figure objects > returned by the library function at her discretion. And of course the > user in her interactive session uses an pylab session in ipython. > > In your example the figure object was already generated from within the > ipython session using fig=figure(1). But this already pops up a canvas > which is not appropriate for a library. In my example I generated the > plot strictly OO with "fig = matplotlib.figure.Figure()". And as I wrote > below, this object cannot be plotted or saved easily, because its not > connected to a canvas, a canvas the library generating the figure knows > nothing about, because it knows nothing about the environment of the > user. In order to save the figure, you have to do the involved: > > >canvas = get_current_fig_manager().canvas > > >canvas.figure = fig > > >canvas.print_figure('myplot.png') > and canvas.show() does not work at all. Much better would methods like: > fig.print_figure() and fig.show(), but this does not work. > > Best Regards, Roman > > * Ryan Krauss <rya...@gm...> [070621 20:40]: > > [...] > > But to answer your question, I think using the OO interface from an > > ipython session is slightly odd in that your are kind of operating in > > two different paradigms. I had no problem showing and saving a figure > > doing the following (from an "ipython -pylab -p scipy" prompt): > > > > fig=figure(1) > > t=arange(0,1,0.01) > > y=sin(2*pi*t) > > ax=fig.add_subplot(111) > > ax.plot(t,y) > > show() > > ax.set_ylabel('$y(t)$') > > ax.set_xlabel('Time (sec)') > > show() > > savefig('test.png') > > > > FWIW, > > > > Ryan > > > > On 6/13/07, Roman Bertle <be...@sm...> wrote: > > >Hello, > > > > > >why don't you reply on the mailing list? Nevermind, the problem is not > > >that I don't know the OO API or that I don't know python well. The > > >problem is that there is missing something in the OO API. If you > > >generate a figure as I have done below: > > > > > >fig = matplotlib.figure.Figure() > > >ax = fig.add_subplot(111) > > >ax.plot(x) > > > > > >Then its not so easy to actually save or display the figure in a ipython > > >-pylab session. fig has a method savefig(), but it fails because it > > >cannot find a canvas. The only way is to generate a canvas and assign > > >fig to it: > > > > > >canvas = get_current_fig_manager().canvas > > >canvas.figure = fig > > >canvas.print_figure('myplot.png') > > > > > >and you cannot do canvas.draw() or canvas.show(), it raises an > > >Exception. Much better would be a working fig.print_figure() and > > >fig.show(), creating a canvas on the fly, and maybe using an optional > > >keyword argument to providing a canvas object. > > > > > >Regards, Roman > > > > > > > > >* Ryan Krauss <rya...@gm...> [070612 08:17]: > > >> Just my 0ドル.02 as a personal testimony about the truth of what John is > > >> saying. I started out using from pylab import * or from pylab import > > >> figure, cla, clf, plot, semilogx, ... in all my code and didn't bother > > >> learning the OO API. This worked great for the first year or two. > > >> Then I wanted to use some of my data processing libraries with a > > >> wxPython gui and they all started out importing Pylab. This created > > >> quite a bit of pain for me. I was rightly advised to make sure I > > >> never used Pylab in a utility module I might some day want to use with > > >> any gui program and had to significantly edit all my module files. > > >> > > >> So, if you are serious about learning Python, then I think it is worth > > >> a little pain now to save yourself a lot of pain later and learn to > > >> use the OO API whenever you aren't just doing something interactively > > >> at the IPython prompt. > > >> > > >> I have found that > > >> fig = Figure() > > >> ax = fig.add_subplot(111) #(or 212 or whatever) > > >> and then using IPython's tab completion with fig.<tab> and ax.<tab> is > > >> usually sufficient to learn the API commands corresponding to the > > >> pylab commands I used for so long. Don't forget to take advantage of > > >> this beautiful IPython feature to find commands: > > >> In [4]: ax.*xlabel*? > > >> ax.set_xlabel > > >> > > >> (finding the correct API commands to replace pylab.xlabel and > > >> pylab.ylabel tripped my up for a little bit). > > >> > > >> > > >> But, I am also a teacher making my students use Python and I will > > >> mention none of this to them and just encourage them to use from pylab > > >> import * to keep the entry barrier as low as possible. > > >> > > >> FWIW, > > >> > > >> Ryan > > >> > > >> On 6/11/07, Roman Bertle <be...@sm...> wrote: > > >> >* John Hunter <jd...@gm...> [070611 16:20]: > > >> >> So the answer of which is better is a question of skill level and > > >> >> context, but my simple advice is to use the pylab syntax from the > > >> >> interactive python shell (and "ipython -pylab" is ideal for this) and > > >> >> the API everywhere else. Most of my scripts are variants of this: > > >> >> > > >> >> import numpy as npy > > >> >> from pylab import figure, close, show > > >> >> fig = figure() > > >> >> ax = fig.add_subplot(111) > > >> >> x = npy.arange(0,10.) > > >> >> ax.plot(x) > > >> >> show() > > >> > > > >> >Hello, > > >> > > > >> >is there also a (possible object oriented) way to show/print a given > > >> >figure? Like fig.show() or fig.print_figure(). I need it because I have > > >> >a script generating (returning) several plots, and the user should be > > >> >able to print/show the plots he likes. At the moment I use: > > >> > > > >> >ipython -pylab > > >> > from myscript import plotgenerator > > >> > fig = plotgenerator() > > >> > canvas = get_current_fig_manager().canvas > > >> > canvas.figure = fig > > >> > canvas.print_figure('myplot.png') > > >> > > > >> >Here plotgenerator does something like: > > >> > from matplotlib.figure import Figure > > >> > fig = Figure() > > >> > ax = myplot.add_subplot(111) > > >> > ax.plot(x) > > >> > > > >> >But its cumbersome, and canvas.show() doesn not work (it gives an > > >> >exception). Best would be if fig.show() (popping up a new canvas) and > > >> >fig.print_figure() worked. > > >> > > > >> >Best Regards, Roman > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
I'd like to make a text instance italic, but this doesn't seem to be working: t = text(15.e3, -70, "25 kHz") t.set_color('r') t.set_style('italic') Stephen
On 6/21/07, Miquel Poch <miq...@gm...> wrote: > And here is my problem. I can put one toolbar for each graph, but when I > make a zoom I want all the graphs change in the same way. That's possible? > I've been thinking in make zoom in one graph, and then create a function > that receive the data of new axes and resize the other graphs. If the axes are in the same figure, you can use the sharex and sharey properties of the Axes to synchronize the pan/zoom ax1 = fig.add_subplot(211) ax2 = fig.add_subplot(212, sharex=ax1) # share x axis zoom only but this won't work across figures. I just made some changes to svn to support this, with new axes methods "sharex_foreign" and "sharey_foregin" to synchronize x or y views of Axes across different figures. This example now lives in svn as examples/shared_axis_across_figures.py Note I changed the little used and somewhat broken custom Axes callback handling -- if any of you are using that see the API_CHANGES notes in svn. """ connect the data limits on the axes in one figure with the axes in another. This is not the right way to do this for two axes in the same figure -- use the sharex and sharey property in that case """ import numpy from pylab import figure, show fig1 = figure() fig2 = figure() ax1 = fig1.add_subplot(111) ax2 = fig2.add_subplot(111) ax1.plot(numpy.random.rand(100), 'o') ax2.plot(numpy.random.rand(100), 'o') ax1.sharex_foreign(ax2) ax2.sharex_foreign(ax1) ax1.sharey_foreign(ax2) ax2.sharey_foreign(ax1) show()
and a quick sample (not suptitle, but using subplots_adjust): import pylab as p p.figtext(0.5,0.9,'Big Old Title', ha='center') p.subplots_adjust(top=0.8) p.subplot(1,2,1) p.title('Lefthand') p.plot([4,3,2,1]) p.subplot(1,2,2) p.title('Righthand') p.plot([3,3,1,3]) On Jun 21, 2007, at 21 Jun,2:14 PM, Philip Austin wrote: > st...@th... writes: >> I didn't see this in the examples. Can I have a figure title and >> titles >> for subplots too? Can someone post a quick sample? Thanks. > > here's a short answer: > http://thread.gmane.org/gmane.comp.python.matplotlib.devel/1071/ > focus=1117 > > -- Phil > > > ---------------------------------------------------------------------- > --- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Pierre GM wrote: > All, > I need to plot stripes of different widths at different locations along the x > axis, but spanning the whole range of y data. Using axvspan in a loop works > quite fine. However, I was wondering whether it wouldn't be more efficient to > build a PatchCollection. > BrokenBarHCollection could be a candidate, but I have trouble figuring how to > force the bars to span the whole range of y: is it possible to force the > ordinates to axes coordinates ? > Thanks a lot in advance for any idea/comment I haven't tried it, but I think you can use the same trick that axvspan uses: trans = blend_xy_sep_transform( self.transData, self.transAxes ) where "self" in this case is the axes instance, so you would use "ax" or whatever. Then, since the collection is an artist, you can use its inherited set_transform(trans) method, and specify your x coordinates in data units and your y as 0 and 1 to span the whole vertical extent. This is assuming you want the width of your bars to be in data coordinates, not just the x-positions of their centers. Eric > P. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
st...@th... writes: > I didn't see this in the examples. Can I have a figure title and titles > for subplots too? Can someone post a quick sample? Thanks. here's a short answer: http://thread.gmane.org/gmane.comp.python.matplotlib.devel/1071/focus=1117 -- Phil
On 6/21/07, Pierre GM <pgm...@gm...> wrote: > All, > I need to plot stripes of different widths at different locations along the x > axis, but spanning the whole range of y data. Using axvspan in a loop works > quite fine. However, I was wondering whether it wouldn't be more efficient to > build a PatchCollection. > BrokenBarHCollection could be a candidate, but I have trouble figuring how to > force the bars to span the whole range of y: is it possible to force the > ordinates to axes coordinates ? > Thanks a lot in advance for any idea/comment You could use this if you pass in a custom blended transform -- see the src for axhspan and axvspan to see how it creates the blended transform (blend of xaxis and yaxis transform) and just pass this off to the bar collection. Let me know if you need any help. JDH
I didn't see this in the examples. Can I have a figure title and titles for subplots too? Can someone post a quick sample? Thanks. Stephen
All, I need to plot stripes of different widths at different locations along the x axis, but spanning the whole range of y data. Using axvspan in a loop works quite fine. However, I was wondering whether it wouldn't be more efficient to build a PatchCollection. BrokenBarHCollection could be a candidate, but I have trouble figuring how to force the bars to span the whole range of y: is it possible to force the ordinates to axes coordinates ? Thanks a lot in advance for any idea/comment P.
Hello, thank you very much for you answer. The oddness clears if you consider that the generating of the figure might be done in an external library. Imagine a data analyze package with functions with can also generate one or more plots. As a library I think here the OO interface is most appropriate. A user of such a library might want to plot figure objects returned by the library function at her discretion. And of course the user in her interactive session uses an pylab session in ipython. In your example the figure object was already generated from within the ipython session using fig=figure(1). But this already pops up a canvas which is not appropriate for a library. In my example I generated the plot strictly OO with "fig = matplotlib.figure.Figure()". And as I wrote below, this object cannot be plotted or saved easily, because its not connected to a canvas, a canvas the library generating the figure knows nothing about, because it knows nothing about the environment of the user. In order to save the figure, you have to do the involved: > >canvas = get_current_fig_manager().canvas > >canvas.figure = fig > >canvas.print_figure('myplot.png') and canvas.show() does not work at all. Much better would methods like: fig.print_figure() and fig.show(), but this does not work. Best Regards, Roman * Ryan Krauss <rya...@gm...> [070621 20:40]: > [...] > But to answer your question, I think using the OO interface from an > ipython session is slightly odd in that your are kind of operating in > two different paradigms. I had no problem showing and saving a figure > doing the following (from an "ipython -pylab -p scipy" prompt): > > fig=figure(1) > t=arange(0,1,0.01) > y=sin(2*pi*t) > ax=fig.add_subplot(111) > ax.plot(t,y) > show() > ax.set_ylabel('$y(t)$') > ax.set_xlabel('Time (sec)') > show() > savefig('test.png') > > FWIW, > > Ryan > > On 6/13/07, Roman Bertle <be...@sm...> wrote: > >Hello, > > > >why don't you reply on the mailing list? Nevermind, the problem is not > >that I don't know the OO API or that I don't know python well. The > >problem is that there is missing something in the OO API. If you > >generate a figure as I have done below: > > > >fig = matplotlib.figure.Figure() > >ax = fig.add_subplot(111) > >ax.plot(x) > > > >Then its not so easy to actually save or display the figure in a ipython > >-pylab session. fig has a method savefig(), but it fails because it > >cannot find a canvas. The only way is to generate a canvas and assign > >fig to it: > > > >canvas = get_current_fig_manager().canvas > >canvas.figure = fig > >canvas.print_figure('myplot.png') > > > >and you cannot do canvas.draw() or canvas.show(), it raises an > >Exception. Much better would be a working fig.print_figure() and > >fig.show(), creating a canvas on the fly, and maybe using an optional > >keyword argument to providing a canvas object. > > > >Regards, Roman > > > > > >* Ryan Krauss <rya...@gm...> [070612 08:17]: > >> Just my 0ドル.02 as a personal testimony about the truth of what John is > >> saying. I started out using from pylab import * or from pylab import > >> figure, cla, clf, plot, semilogx, ... in all my code and didn't bother > >> learning the OO API. This worked great for the first year or two. > >> Then I wanted to use some of my data processing libraries with a > >> wxPython gui and they all started out importing Pylab. This created > >> quite a bit of pain for me. I was rightly advised to make sure I > >> never used Pylab in a utility module I might some day want to use with > >> any gui program and had to significantly edit all my module files. > >> > >> So, if you are serious about learning Python, then I think it is worth > >> a little pain now to save yourself a lot of pain later and learn to > >> use the OO API whenever you aren't just doing something interactively > >> at the IPython prompt. > >> > >> I have found that > >> fig = Figure() > >> ax = fig.add_subplot(111) #(or 212 or whatever) > >> and then using IPython's tab completion with fig.<tab> and ax.<tab> is > >> usually sufficient to learn the API commands corresponding to the > >> pylab commands I used for so long. Don't forget to take advantage of > >> this beautiful IPython feature to find commands: > >> In [4]: ax.*xlabel*? > >> ax.set_xlabel > >> > >> (finding the correct API commands to replace pylab.xlabel and > >> pylab.ylabel tripped my up for a little bit). > >> > >> > >> But, I am also a teacher making my students use Python and I will > >> mention none of this to them and just encourage them to use from pylab > >> import * to keep the entry barrier as low as possible. > >> > >> FWIW, > >> > >> Ryan > >> > >> On 6/11/07, Roman Bertle <be...@sm...> wrote: > >> >* John Hunter <jd...@gm...> [070611 16:20]: > >> >> So the answer of which is better is a question of skill level and > >> >> context, but my simple advice is to use the pylab syntax from the > >> >> interactive python shell (and "ipython -pylab" is ideal for this) and > >> >> the API everywhere else. Most of my scripts are variants of this: > >> >> > >> >> import numpy as npy > >> >> from pylab import figure, close, show > >> >> fig = figure() > >> >> ax = fig.add_subplot(111) > >> >> x = npy.arange(0,10.) > >> >> ax.plot(x) > >> >> show() > >> > > >> >Hello, > >> > > >> >is there also a (possible object oriented) way to show/print a given > >> >figure? Like fig.show() or fig.print_figure(). I need it because I have > >> >a script generating (returning) several plots, and the user should be > >> >able to print/show the plots he likes. At the moment I use: > >> > > >> >ipython -pylab > >> > from myscript import plotgenerator > >> > fig = plotgenerator() > >> > canvas = get_current_fig_manager().canvas > >> > canvas.figure = fig > >> > canvas.print_figure('myplot.png') > >> > > >> >Here plotgenerator does something like: > >> > from matplotlib.figure import Figure > >> > fig = Figure() > >> > ax = myplot.add_subplot(111) > >> > ax.plot(x) > >> > > >> >But its cumbersome, and canvas.show() doesn not work (it gives an > >> >exception). Best would be if fig.show() (popping up a new canvas) and > >> >fig.print_figure() worked. > >> > > >> >Best Regards, Roman
Hi! I'm trying to embed Matplotlib in wxPython and I find myself in some troubles. I'm sure someone here could help me. I need an application where plot some functions, three or four graphics at the same time. I've done a frame, and with matplotlib I've plot two graphs in it. I've introduced a toolbar, NavigationToolbar2Wx. And here is my problem. I can put one toolbar for each graph, but when I make a zoom I want all the graphs change in the same way. That's possible? I've been thinking in make zoom in one graph, and then create a function that receive the data of new axes and resize the other graphs. Thanks in advance, all suggestions gratefully received! Miquel
It would be VERY nice if all characteristics of a point , e.g., alpha, marker, label, etc., were individually configurable via a sequence in the scatter command just as color and size are now. Does anyone have a patch for this? Jon
I have a problem where I need to quickly inspect 20-30 plots. I want to open a plotting window, plot the first plot, then hit return to see the nest plot appear in the same window. Below is my script, but it creates a window that has to be closed before it loops over the rest of the plots. How can I avoid that the first plot has to be closed "manually"? Cheers Tommy Note: I know confirm() is overkill, but I just ripped it out of a different program to quickly put this script together :) import pylab from optparse import OptionParser parser = OptionParser(version="%prog 0.01a") parser.add_option("-i","--infile", dest="infname", action="store", help="The input file", metavar="INFILE") parser.add_option("-n","--num", dest="n", action="store",type="int", help="number of files", metavar="N") (options,args) = parser.parse_args() def confirm(_prompt=None, _default=False): """prompts for yes or no response. Return True for yes and False for no.""" promptstr = _prompt if (not promptstr): promptstr = "Confirm" if (_default): prompt = "%s [%s]|%s: " % (promptstr, "y", "n") else: prompt = "%s [%s]|%s: " % (promptstr, "n", "y") while (True): ans = raw_input(prompt) if (not ans): return _default if ((ans != "y") and (ans != "Y") and (ans != "n") and (ans ! = "N")): print "please enter again y or n." continue if ((ans == "y") or (ans == "Y")): return True if ((ans == "n") or (ans == "N")): return False pylab.figure(figsize=(12,14)) for i in xrange(1,options.n+1): t_list = [] a_list = [] e_list = [] i_list = [] q_list = [] Q_list = [] fname = "%s%02i.aei" % (options.infname,i) print fname all_lines = open(fname,"r").readlines() n=0 for lines in all_lines: if n > 3: t_in,a_in,e_in,i_in,peri_in,node_in,M_in,mass = lines.split() t_list.append(float(t_in)) a_list.append(float(a_in)) e_list.append(float(e_in)) i_list.append(float(i_in)) q_list.append(float(float(a_in)*(1. - float(e_in)))) Q_list.append(float(float(a_in)*(1. + float(e_in)))) n+=1 pylab.clf() pylab.subplot(321) pylab.plot(t_list,a_list,'r-') pylab.plot(t_list,Q_list,'b-') pylab.plot(t_list,q_list,'g-') pylab.subplot(322) pylab.plot(t_list,a_list,'r-') pylab.subplot(323) pylab.plot(t_list,Q_list,'b-') pylab.subplot(324) pylab.plot(t_list,q_list,'g-') pylab.subplot(325) pylab.plot(t_list,e_list,'r-') pylab.subplot(326) pylab.plot(t_list,i_list,'r-') # if i == 1: pylab.show() end = confirm("Finished?")
Unfortunately, the 3D plotting capability is incomplete and mostly unmaintained. Eric Orest Kozyar wrote: > I just discovered the 3D plotting functions that matplotlib offers > (i.e. Axes3D with plot_surface, etc). This is a great package, but I > have not been able to find documentation for some parameters. For > example, the plot_surface function appears to take the following > arguments: > (X, Y, Z, *args, **kwargs) > > x,y, and z are pretty much self-explanatory, but how do I find out > what arguments can be passed to *args and **kwargs? There's no > docstring available for these functions. > > One thing I would really love to be able to do is generate a surface > map that is color-coded. Right now I can generate a single-color > surface map, but a color-coded surface map would be much easier to > interpret. > > Thanks! > Orest > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Hey, > I would love to be able to plot them next to each > other as it should be (like this basically: > http://img75.imageshack.us/img75/6218/distthreeef4.jpg ) This is quite easy... You should do sth like: width=3D0.5 position =3D 0.25 bar(xAxis-position, yAxis, width, color=3D'#BBBBBB') width defines the width of the bar. And position allows you to move =20 the bar along the x-axis ticks (by addition or substracting position =20 to you x-axis vector) Benoit > Anyone has some suggestion? > > Thanks! > Giorgio > > ----------------------------------------------------------------------=20= > --- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Dr. Benoit Donnet Universit=E9 Catholique de Louvain (UCL) Facult=E9 des Sciences Appliqu=E9es - D=E9partement d'Ing=E9nierie =20 Informatique (INGI) Place Sainte Barbe, 2 1348 Louvain-la-Neuve Belgium Phone: +32 10 47 87 18 Home page: http://inl.info.ucl.ac.be/donnet
Hi there, I am trying to find a way to improve the plotting of a distribution. I am using the boxplot command and the dist command to plot the spread of a distribution: see first two panel here: http://img75.imageshack.us/img75/5260/distonevy0.png Now, whenever I add data to be plot on the hold axes I face two problems that I don't really know how to solve ( see: http://img232.imageshack.us/img232/2219/disttwopl2.png ) The first one is that I don't manage to get the upper boxplot to be drawn using different colors. The second is that the bars representing the distribution (middle panel) are drawn one in front of the others, hiding in this way the ones in the back. I would love to be able to plot them next to each other as it should be (like this basically: http://img75.imageshack.us/img75/6218/distthreeef4.jpg ) Anyone has some suggestion? Thanks! Giorgio
I just discovered the 3D plotting functions that matplotlib offers (i.e. Axes3D with plot_surface, etc). This is a great package, but I have not been able to find documentation for some parameters. For example, the plot_surface function appears to take the following arguments: (X, Y, Z, *args, **kwargs) x,y, and z are pretty much self-explanatory, but how do I find out what arguments can be passed to *args and **kwargs? There's no docstring available for these functions. One thing I would really love to be able to do is generate a surface map that is color-coded. Right now I can generate a single-color surface map, but a color-coded surface map would be much easier to interpret. Thanks! Orest
Hi, 2007年6月19日, John Hunter <jd...@gm...>: <snip> > * you may want to look at the line editor dialog in backend_gtk.py for > inspiration. This uses drop down menus for linestyles, color dialog > boxes to pick colors, etc... I'll paste in the code below > > Thanks, > JDH > > class DialogLineprops: Just for the record, I had to explicitly import gtk.glade and to put a self.show() call in the __init__() method to make this work. Nice example though. Thanks :). Regards, ~ Antonio