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
(10) |
2
(17) |
3
(14) |
4
(28) |
5
(23) |
6
(12) |
7
(3) |
8
(11) |
9
(29) |
10
(31) |
11
(9) |
12
(35) |
13
(3) |
14
(9) |
15
(16) |
16
(14) |
17
(10) |
18
(7) |
19
(3) |
20
|
21
(4) |
22
(6) |
23
(14) |
24
(16) |
25
(10) |
26
(5) |
27
(4) |
28
(8) |
29
(19) |
30
(21) |
|
|
|
|
There is definitely something weird going on here. It could still be a bad command on my part, but I cannot get Windows to plot interactively if I embed it in pyqt. I even tried adapting one of the qt examples from the matplotlib homepage and I still have the same problem (i.e., it will only plot point by point in Linux). I'm attaching two files to illustrate: (1) a simple program that works interactively in both Windows and Linux without qt; and (2) the example from the homepage with my code inserted (which is the same code that I used in the first attachment that behaves properly). I'm wondering if there is some issue with qt and Windows at work. Any thoughts? Thanks, Steve --- On Tue, 6/9/09, John Hunter <jd...@gm...> wrote: From: John Hunter <jd...@gm...> Subject: Re: [Matplotlib-users] MPL with PyQt: different behavior on Windows vs. Linux To: "Steve Nicholes" <ema...@ya...> Cc: mat...@li... Date: Tuesday, June 9, 2009, 6:25 PM On Tue, Jun 9, 2009 at 5:17 PM, Steve Nicholes<ema...@ya...> wrote: > I am writing some code for automated testing via GPIB using MPL and PyQt. > To simulate automated data collection while debugging the program, I have > added a for loop (see below) after reading in a data file that plots each > point one by one. When I run the program in Linux, I see each point appear > on the canvas one by one as designed, but when I run the same code in > Windows, nothing shows up on the canvas during the for loop. Instead, once > the loop has completed, all points appear simulataneously. Is there any > reason the why calls to canvas.draw() show nothing when run in Windows? I'm > really lost on this one and would appreciate it someone can tell me what I'm > doing wrong. If you need more info on what I'm doing, please let me know. It would help if we could see the whole program. Ie, I assume this is a pure qt app with no import of pyplot/pylab, but w/o seeing any code I cannot be sure. Also, check the qt examples at http://matplotlib.sourceforge.net/examples/animation/index.html and see if they work on windows. If so, perhaps you can borrow inspiration from them. If not, perhaps we need to do something different for qt/windows animation. JDH JDH
I guess I misunderstood your intention. As you posted the message in the mpl list, I assumed that you want to crop out the boundary of the mpl figure, which seems to be not the case. Sorry for the noise. -JJ On Wed, Jun 10, 2009 at 12:09 PM, Nils Wagner<nw...@ia...> wrote: > On 2009年6月10日 02:26:54 -0400 > Jae-Joon Lee <lee...@gm...> wrote: >> >> If you're using very recent version of mpl, you may try savefig with >> "bbox_inches" option. >> >> savefig("a.png", bbox_inches="tight") >> >> The algorithm is not perfect, but will work for most of simple plots. >> >> Regards, >> >> -JJ >> > Hm, it doesn't work as expected. Am I missing something ? > The example is attached. > > Cheers, > Nils >
On 2009年6月10日 02:26:54 -0400 Jae-Joon Lee <lee...@gm...> wrote: > If you're using very recent version of mpl, you may try >savefig with > "bbox_inches" option. > > savefig("a.png", bbox_inches="tight") > > The algorithm is not perfect, but will work for most of >simple plots. > > Regards, > > -JJ > Hm, it doesn't work as expected. Am I missing something ? The example is attached. Cheers, Nils
On Wed, Jun 10, 2009 at 9:40 AM, Paul Anton Letnes<pau...@gm...> wrote: > Hm, I see. Thanks for an informative answer. I'll dig into my rcParams > and matplotlibrc then... That is worth doing, but you needn't change the defaults. You can also pass in the arguments explicitly: fig = plt.figure((3,3)) fig.subplots_adjust(left=0.2, bottom=0.2) ax = fig.add_subplot(111) ax.plot(something) ax.set_xlabel('test', fontsize=10) for label in ax.get_xticklabels() + ax.get_yticklabels(): label.set_fontsize(8) plt.show() If you do want to change the defaults via matplotlibrc, though, something to bear in mind is that you can have "per-directory" rc files. So for example if you want your defaults to be changed for a figures for publication, you can drop an rc file into the scripts directory for that publication, and that will be used for that directory only and will not affect the global defaults in ~/.matplotlib/matplotlibrc. See http://matplotlib.sourceforge.net/users/customizing.html JDH
Hi John, John Hunter <jd...@gm...> writes: > On Wed, Jun 10, 2009 at 9:11 AM, John Hunter<jd...@gm...> wrote: >> ax.lines.remove(someline) >> fig.canvas.draw() > See also > http://matplotlib.sourceforge.net/users/artists.html Thank you very much, this helped a lot. (the manpages to artists and axes are a bit complicated to use since they are far too long) Best regards Ole
On 10. juni. 2009, at 14.53, John Hunter wrote: > On Wed, Jun 10, 2009 at 1:58 AM, Paul Anton > Letnes<pau...@gm...> wrote: > >>> This _must_ be a bug. Consider the following: >>> ############## >>> import matplotlib > > No it is not a bug -- mpl is doing what you tell it to do. Consider > >>>> figure() >>>> subplot(111) >>>> plot([1,2,3]) >>>> xlabel('hi mom', fontsize=100) > > Each command has precise meaning -- the fig creates a figure using the > default size, the subplot occupies a fraction of that figure according > to the default ratios in the subplots_adjust parameters, and the > xlabel makes a label at an indicated physical size. You may not be > explicitly setting those sizes, but they are all defined via defaults > in the matplotlibrc. We try and make mpl do what you tell it to do, > not to try and out-smart you and do what we think you are telling it > to do. > > Now I definitely support the idea that we should have a *feature* to > auto-adjust the subplots_adjust params and fontsizes so that it "just > works" more often. But this should be an optional feature so the user > who wants to express their intent clearly will not constantly be > stymied by mpl adjusting the sizes. Michael Droettboom has worked on > it and it is a difficult problem to get right. > > JDH Hm, I see. Thanks for an informative answer. I'll dig into my rcParams and matplotlibrc then... Best regards, Paul.
hi, The Windows installer binaries have been missing from sourceforge for awhile now. I understand there are problems with the latest version for windows. Where can I get the previous versions that have working Windows installer binaries? Thanks in advance.
On Wed, Jun 10, 2009 at 9:11 AM, John Hunter<jd...@gm...> wrote: >> The other question that now remains is: how can I remove a line from an >> axes? > > ax.lines.remove(someline) > fig.canvas.draw() See also http://matplotlib.sourceforge.net/users/artists.html which covers this and other useful things. JDH
On Wed, Jun 10, 2009 at 9:04 AM, Ole Streicher<ole...@gm...> wrote: > Hi John, > > John Hunter <jd...@gm...> writes: >> If for some reason the built in pick_event is unsuitable, you can >> create your own matplotlib.backend_bases.MouseEvent and call >> line.contains(event) for each line you want to hit test. > > Thank you, that works for me. But for some reason, the "y" coordinate is > inversed in Qt and matplotlib? I have to specify Yes, for mpl 0,0 is bottom, left whereas many GUI canvases call 0,0 top, left > The other question that now remains is: how can I remove a line from an > axes? ax.lines.remove(someline) fig.canvas.draw() JDH
Hi John, John Hunter <jd...@gm...> writes: > If for some reason the built in pick_event is unsuitable, you can > create your own matplotlib.backend_bases.MouseEvent and call > line.contains(event) for each line you want to hit test. Thank you, that works for me. But for some reason, the "y" coordinate is inversed in Qt and matplotlib? I have to specify def get_lines_at_point(self, point): mpl_event = MouseEvent('button_press_event', self, point.x(), self.height() - point.y()) ######################### ret = [ ] for line in self.axes.get_lines(): picked, details = line.contains(mpl_event) if picked: ret.append(line) return ret The other question that now remains is: how can I remove a line from an axes? Best regards Ole
On Wed, Jun 10, 2009 at 6:22 AM, Ole Streicher <ole...@gm...>wrote: > Hi Mathias, > > Matthias Michler <Mat...@gm...> writes: > > you can reset the ydata using: > > ydata = myline.get_ydata() > > ydata += 50 > > myline.set_ydata(ydata) # pass new data to line object > > Does this work for you? > > Yes. Altough I dont understand why I have to set it again (the ydata > still belong to the curve) The when you use set_data, the widget is aware the data has changed and sets its _invalid member to True, which triggers a full redraw. When you just modify the array, the line object isn't aware that the data has changed, and thus just redraws from its (I believe) cached version. Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma Sent from Norman, Oklahoma, United States
On Tue, Jun 9, 2009 at 9:42 AM, Nicholas Stephens < Nic...@un...> wrote: > Hi all, > > I am still very green when it comes to the use of matplotlib but I am > finding the versatility and robustness of the package extremely useful > at present. One application I am constantly using matplotlib for > concerns a break in the axis. Although I have a script or two based on > an original from > http://matplotlib.sourceforge.net/examples/pylab_examples/manual_axis.html > I am curious to put something together that automates the process for my > own purposes. In doing this I have come across the PyX > graph.axis.split() command. I am wondering if the simple way that pyx > makes the break could be simply relayed in matplotlib. > The new dropped spines support in SVN HEAD might help you out: http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma
On Wed, Jun 10, 2009 at 6:55 AM, Ole Streicher<ole...@gm...> wrote: > Hi again, > > when right-clicking on one or more lines in a plot, I want to present > the user a context menu where he can select to remove these lines. > > Preferrably I want to do this not with a 'pick_event' connection but > with the (Qt) backend methods since the context menu should contain more > options (which shall be shown also when right-clicking on the diagram > background). > > Unfortunately, I have no idea, how to do this. At first, I found only > the pick_event() which responds to a left mouse click. Is there a way to > get the Line2D instances that would be picked by specifying the mouse > position? The pick_event is fired off with any mouse press. See the following example: you can select the line with the left or right mouse button:: import numpy as np import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(111) x = np.arange(10) line1, = ax.plot(x, x, picker=5, label='x') line2, = ax.plot(x, x*2, picker=5, label='x^2') def on_pick(pickevent): thisline = pickevent.artist print 'you picked line=%s with button=%s'%( thisline.get_label(), pickevent.mouseevent.button) fig.canvas.mpl_connect('pick_event', on_pick) plt.show() If for some reason the built in pick_event is unsuitable, you can create your own matplotlib.backend_bases.MouseEvent and call line.contains(event) for each line you want to hit test. http://matplotlib.sourceforge.net/api/artist_api.html#matplotlib.lines.Line2D.contains http://matplotlib.sourceforge.net/api/backend_bases_api.html#matplotlib.backend_bases.MouseEvent JDH
On Wed, Jun 10, 2009 at 1:58 AM, Paul Anton Letnes<pau...@gm...> wrote: >> This _must_ be a bug. Consider the following: >> ############## >> import matplotlib No it is not a bug -- mpl is doing what you tell it to do. Consider >>> figure() >>> subplot(111) >>> plot([1,2,3]) >>> xlabel('hi mom', fontsize=100) Each command has precise meaning -- the fig creates a figure using the default size, the subplot occupies a fraction of that figure according to the default ratios in the subplots_adjust parameters, and the xlabel makes a label at an indicated physical size. You may not be explicitly setting those sizes, but they are all defined via defaults in the matplotlibrc. We try and make mpl do what you tell it to do, not to try and out-smart you and do what we think you are telling it to do. Now I definitely support the idea that we should have a *feature* to auto-adjust the subplots_adjust params and fontsizes so that it "just works" more often. But this should be an optional feature so the user who wants to express their intent clearly will not constantly be stymied by mpl adjusting the sizes. Michael Droettboom has worked on it and it is a difficult problem to get right. JDH
> When I f.e. change > > #xtick.labelsize : 14 (from '12') > #xtick.direction : out (from 'in') Uncomment the lines. #xtick.labelsize : 14 #xtick.direction : out to xtick.labelsize : 14 xtick.direction : out
Hi again, when right-clicking on one or more lines in a plot, I want to present the user a context menu where he can select to remove these lines. Preferrably I want to do this not with a 'pick_event' connection but with the (Qt) backend methods since the context menu should contain more options (which shall be shown also when right-clicking on the diagram background). Unfortunately, I have no idea, how to do this. At first, I found only the pick_event() which responds to a left mouse click. Is there a way to get the Line2D instances that would be picked by specifying the mouse position? At second, if I have a Line2D instance: how can I remove it from the axes? Best regards Ole
Hi Jothy, first of all, please do not use -announce mailing list, that is for... announcement. There is matplotlib-users for users support request like this one (move the discussion there). On Wed, Jun 10, 2009 at 11:08, KS Jothy<jot...@gm...> wrote: > Hi, > > I am getting a strange error while platting a graph in the matplotlib widget > embedded in a PyQt form. > > Initially the axis labels range from 0.0 to 1.0, then after plotting these > labels fail to disappear, it appears along with the new ticklabels. > > Please see the attached screenshot could you please post a short example (ideally the smallest part able) to reproduce the problem? Regards, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi
Hi Mathias, Matthias Michler <Mat...@gm...> writes: > you can reset the ydata using: > ydata = myline.get_ydata() > ydata += 50 > myline.set_ydata(ydata) # pass new data to line object > Does this work for you? Yes. Altough I dont understand why I have to set it again (the ydata still belong to the curve) Thanks, Ole
Dear all, just noticed that the problem also happens with the raw_input - I guess I just closed the figure-windows during the raw_input-call. Closing the figures (either manually or with pylab.close()) prevents the crash, but I wonder why? Memory should not be an issue, python crashes when only using 100MB. Cheers, Gerd Wellenreuther, Gerd wrote: > Dear all, > > I just again faced a problem appearing whenever I quickly generate > multiple plots (using Windows XP, Python 2.5, matplotlib 0.98.1): > >> pylab.ion() >> for n in range(n_elements): >> ## print >> ## print element_symbols[n]+'-'+element_linegroup[n] >> ## print normalized_mass_fractions[:,:,n] >> pylab.figure() >> ## pylab.imshow(normalized_mass_fractions[:,:,n]) >> pylab.pcolor(normalized_mass_fractions[:,:,n]) >> pylab.title(element_symbols[n]+'-'+element_linegroup[n]) >> pylab.draw() >> ## raw_input() >> > > My script crashes if and only if I do not have a raw_input at the end, > windows points towards: > > AppName: pythonw.exe AppVer: 0.0.0.0 ModName: tk84.dll > ModVer: 8.4.2.12 Offset: 0000bddf > > Most probably I am just abusing python/pylab, or maybe this is a known > issue? > > Cheers, Gerd
Hi, I want to change the value of a line in an axes. What I tried is myline = axes.plot(...) xdata, ydata = myline.get_data() for i in range(ydata.__len__()): ydata[i] += 50 to shift all y values up by 50. But I dont see the change I made, even after a show(). How can I force the diagram to show the changed value? Regards Ole
Dear all, I just again faced a problem appearing whenever I quickly generate multiple plots (using Windows XP, Python 2.5, matplotlib 0.98.1): > > pylab.ion() > for n in range(n_elements): > ## print > ## print element_symbols[n]+'-'+element_linegroup[n] > ## print normalized_mass_fractions[:,:,n] > pylab.figure() > ## pylab.imshow(normalized_mass_fractions[:,:,n]) > pylab.pcolor(normalized_mass_fractions[:,:,n]) > pylab.title(element_symbols[n]+'-'+element_linegroup[n]) > pylab.draw() > ## raw_input() > My script crashes if and only if I do not have a raw_input at the end, windows points towards: AppName: pythonw.exe AppVer: 0.0.0.0 ModName: tk84.dll ModVer: 8.4.2.12 Offset: 0000bddf Most probably I am just abusing python/pylab, or maybe this is a known issue? Cheers, Gerd -- Dr. Gerd Wellenreuther beamline scientist P06 "Hard X-Ray Microprobe/Nanoprobe" Petra III project HASYLAB at DESY Notkestr. 85 22603 Hamburg Tel.: + 49 40 8998 5701
> On 9. juni. 2009, at 17.18, Jouni K. Seppänen wrote: > >> Chaitanya Krishna <ic...@gm...> writes: >> >>> On Tue, Jun 9, 2009 at 12:05 PM, Paul Anton Letnes <pau...@gm... >>> > wrote: >>>> >>>> When I run the script below, the xlabel and ylabel do not show >>>> up. If I >>>> increase the figure size, it all works fine. >>> >>> I am not sure if it is a bug. But, it is usual that such a thing >>> happens when you are making small figures (like in your case). >> >> Arguably it is a bug, since it is reasonable to expect that when >> you set >> an xlabel or ylabel (or, say, large yticklabels), it shows up in the >> figure. There are at least two problems to solve here: what should >> the >> user interface be like, and how can it best be implemented? >> >> The user interface question seems difficult to me. If you set the >> figure >> size to something small (as in this case) and then add labels, should >> matplotlib reduce the area available for the plot? Or should it >> reduce >> the font size of the labels and the tick labels, and perhaps the >> amount >> of white space between the axes and the labels? Or some combination >> of >> these? >> >> The implementation question could also be somewhat hairy, since the >> bounding box of text objects depends on the backend. If agg and pdf >> disagree on the size of a label, is it OK to get different-looking >> results in png and pdf? >> >> -- >> Jouni K. Seppänen >> http://www.iki.fi/jks >> >> >> ------------------------------------------------------------------------------ >> Crystal Reports - New Free Runtime and 30 Day Trial >> Check out the new simplified licensing option that enables unlimited >> royalty-free distribution of the report engine for externally facing >> server and web deployment. >> http://p.sf.net/sfu/businessobjects >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > This _must_ be a bug. Consider the following: > ############## > import matplotlib > matplotlib.rcParams['figure.figsize'] = [8.85, 3.20] > matplotlib.use('pdf') > from pylab import * > > xs = linspace(0, 2 * pi) > ys = sin(xs) > plot(xs, ys) > xlabel(r'$T_{est}$') > ylabel('y axis') > > savefig('test') > ############## > Here, the vertical size is clearly large enough for a label, as it > is a full inch larger than in the previous example. However, the > xlabel is truncated. This _must_ be a bug. When I make a plot, I > would expect that all parts of the plot appear on the plot. > > As an example, in Gnuplot, the text just appears in the "right > place", but is too large (overlaps the plot, etc). Hence, you see > for yourself that the font size is the problem. > > Anyway, it can't be the font size here, as the xlabel was completely > outside the "bounding box" (I'm not sure of the terminology). To me, > it just looks like a problem with the scaling - the plot looks > perfectly OK in Illustrator, disregarding that it doesn't fit inside > the "viewing window". > > I'm not an expert, and I certainly don't know how to fix this. But I > do know that other software manages this nicely. Don't get me wrong, > I use matplotlib because I like it - but it should be possible to > fix this problem. > > > Best regards, > Paul.
On 9. juni. 2009, at 17.18, Jouni K. Seppänen wrote: > Chaitanya Krishna <ic...@gm...> writes: > >> On Tue, Jun 9, 2009 at 12:05 PM, Paul Anton Letnes <pau...@gm... >> > wrote: >>> >>> When I run the script below, the xlabel and ylabel do not show up. >>> If I >>> increase the figure size, it all works fine. >> >> I am not sure if it is a bug. But, it is usual that such a thing >> happens when you are making small figures (like in your case). > > Arguably it is a bug, since it is reasonable to expect that when you > set > an xlabel or ylabel (or, say, large yticklabels), it shows up in the > figure. There are at least two problems to solve here: what should the > user interface be like, and how can it best be implemented? > > The user interface question seems difficult to me. If you set the > figure > size to something small (as in this case) and then add labels, should > matplotlib reduce the area available for the plot? Or should it reduce > the font size of the labels and the tick labels, and perhaps the > amount > of white space between the axes and the labels? Or some combination of > these? > > The implementation question could also be somewhat hairy, since the > bounding box of text objects depends on the backend. If agg and pdf > disagree on the size of a label, is it OK to get different-looking > results in png and pdf? > > -- > Jouni K. Seppänen > http://www.iki.fi/jks > > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users This _must_ be a bug. Consider the following: ############## import matplotlib matplotlib.rcParams['figure.figsize'] = [8.85, 3.20] matplotlib.use('pdf') from pylab import * xs = linspace(0, 2 * pi) ys = sin(xs) plot(xs, ys) xlabel(r'$T_{est}$') ylabel('y axis') savefig('test') ############## Here, the vertical size is clearly large enough for a label, as it is a full inch larger than in the previous example. However, the xlabel is truncated. This _must_ be a bug. When I make a plot, I would expect that all parts of the plot appear on the plot. As an example, in Gnuplot, the text just appears in the "right place", but is too large (overlaps the plot, etc). Hence, you see for yourself that the font size is the problem. Anyway, it can't be the font size here, as the xlabel was completely outside the "bounding box" (I'm not sure of the terminology). To me, it just looks like a problem with the scaling - the plot looks perfectly OK in Illustrator, disregarding that it doesn't fit inside the "viewing window". I'm not an expert, and I certainly don't know how to fix this. But I do know that other software manages this nicely. Don't get me wrong, I use matplotlib because I like it - but it should be possible to fix this problem. Best regards, Paul.
If you're using very recent version of mpl, you may try savefig with "bbox_inches" option. savefig("a.png", bbox_inches="tight") The algorithm is not perfect, but will work for most of simple plots. Regards, -JJ On Tue, Jun 9, 2009 at 1:22 PM, Nils Wagner<nw...@ia...> wrote: > Hi all, > > I am looking for an autocrop function. > > It should remove borders from an image. > Is it available in matplotlib ? > > Any pointer would be appreciated. > > Thanks in advance > > Nils > > > > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users >
Thanks John. I hope you aren't receiving this reply twice (my email kicked me out when I hit send). I actually am importing pylab so it isn't an entirely qt app. I didn't post all of the code originally b/c it is long (and it would reveal how poor of a programmer I am :) ), but here are the relevant sections. The problematic section is in blue. Please let me know if you need anything else. I will try the examples you suggested the next time on I'm a Windows box to see if they behave differently than in Linux. Thanks! #!/usr/bin/env python from PyQt4.QtCore import * from PyQt4.QtGui import * from pylab import * from pulse_ui import Ui_MainWindow from mpl_pyqt4_widget import MPL_Widget class Plot_Widget(QMainWindow, Ui_MainWindow): def __init__(self, parent = None): QMainWindow.__init__(self) self.setupUi(self) self.label_checkmark.hide() self.usr_click = 1 self.abort_run = 0 self.R = 1.6e-19/(6.626e-34*3e8/(float(self.lineEdit_wavelength.text())*10**-9)) self.facet_fraction = 0.5 self.lengths = [] self.etads = [] self.data = loadtxt('test_data.csv',comments = '#',delimiter = ',',skiprows = 0) self.slider_stop.setMaximum(len(self.data)) QObject.connect(self.plotBtn, SIGNAL("clicked()"),self.plotData) QObject.connect(self.pushButton_abort,SIGNAL('clicked()'),self.abort) def abort(self): self.abort_run = 1 def plotSetupMain(self): self.plotWidget.canvas.ax.cla() self.plotWidget.canvas.ax.set_title("Pulsed LIV") self.plotWidget.canvas.ax.title.set_fontsize(10) self.plotWidget.canvas.ax.set_xlabel("Current (mA)", fontsize = 9) self.plotWidget.canvas.ax.set_ylabel("Light (mW)", fontsize = 9) labels_x = self.plotWidget.canvas.ax.get_xticklabels() labels_y = self.plotWidget.canvas.ax.get_yticklabels() for xlabel in labels_x: xlabel.set_fontsize(8) for ylabel in labels_y: ylabel.set_fontsize(8) ylabel.set_color('b') self.plotWidget.canvas.ax.grid() def plotData(self): self.plotSetupMain() self.label_checkmark.hide() del self.plotWidget.canvas.ax.lines[:] for i in range(0,len(self.data)): line, = self.plotWidget.canvas.ax.plot([self.data[i,1]], [self.data[i,0]], 'bo') self.plotWidget.canvas.draw() if self.abort_run == 1: break if self.abort_run == 0: self.plotWidget.canvas.ax.plot(self.data[:,1], self.data[:,0], 'bo') self.usr_click = 0 self.slider_start.setValue(len(self.data)/2) self.usr_click = 0 self.slider_stop.setValue(len(self.data)) a,b = polyfit(self.data[self.slider_start.value():self.slider_stop.value(),1],self.data[self.slider_start.value():self.slider_stop.value(),0+self.acquire],1) fit = a*self.data[:,1] + b self.plotWidget.canvas.ax.plot(self.data[:,1], fit, 'g-',linewidth = '2') self.plotWidget.canvas.ax.axvline(self.data[self.slider_start.value()-1,1],linestyle = '--',color = 'r') self.plotWidget.canvas.ax.axvline(self.data[self.slider_stop.value()-1,1],linestyle = '--',color = 'k') self.plotWidget.canvas.draw() self.label_etad.setText('%.3f' % (a*self.R/self.facet_fraction)) self.label_ith.setText('%.3f' % (-b/a) + ' mA') else: self.abort_run = 0 --- On Tue, 6/9/09, John Hunter <jd...@gm...> wrote: From: John Hunter <jd...@gm...> Subject: Re: [Matplotlib-users] MPL with PyQt: different behavior on Windows vs. Linux To: "Steve Nicholes" <ema...@ya...> Cc: mat...@li... Date: Tuesday, June 9, 2009, 6:25 PM On Tue, Jun 9, 2009 at 5:17 PM, Steve Nicholes<ema...@ya...> wrote: > I am writing some code for automated testing via GPIB using MPL and PyQt. > To simulate automated data collection while debugging the program, I have > added a for loop (see below) after reading in a data file that plots each > point one by one. When I run the program in Linux, I see each point appear > on the canvas one by one as designed, but when I run the same code in > Windows, nothing shows up on the canvas during the for loop. Instead, once > the loop has completed, all points appear simulataneously. Is there any > reason the why calls to canvas.draw() show nothing when run in Windows? I'm > really lost on this one and would appreciate it someone can tell me what I'm > doing wrong. If you need more info on what I'm doing, please let me know. It would help if we could see the whole program. Ie, I assume this is a pure qt app with no import of pyplot/pylab, but w/o seeing any code I cannot be sure. Also, check the qt examples at http://matplotlib.sourceforge.net/examples/animation/index.html and see if they work on windows. If so, perhaps you can borrow inspiration from them. If not, perhaps we need to do something different for qt/windows animation. JDH JDH