From: Russell E. O. <ro...@uw...> - 2010-09-24 17:37:28
|
In article <AANLkTinJBFO6ZioH1J_w=0Ut...@ma...>, John Hunter <jd...@gm...> wrote: > On Wed, Sep 22, 2010 at 8:31 PM, C M > <cmp...@gm...> wrote: > > > Until a more permanent solution is figured out, can anyone recommend > > any workarounds, even if they are a little clunky? I'm embedding mpl > > plots in wxPython and am also finding this issue suboptimal. > > Change your subplots adjust parameters to make the default bottom, > left, wspace and hspace wider. This will reduce the chance of > overlaps. > > http://matplotlib.sourceforge.net/search.html?q=subplots_adjust > > The defaults can be changed in your rc file > > http://matplotlib.sourceforge.net/users/customizing.html > > See also these recipes on the FAQ to automatically choose boundaries > > http://matplotlib.sourceforge.net/faq/howto_faq.html#move-the-edge-of-an-axe > s-to-make-room-for-tick-labels > > http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room > -for-tick-labels > > Automatic layout to avoid overlap is not an easy problem -- Michael > Droetboom worked on it for a while but didn't get to a satisfactory > point. So far our philosophy has been : make it easy to customize > rather than do it automatically. I realize this is not always a good > approach, especially in automated figure generators where you don't > have access to the data ahead of time. One possibility is to offer a mode whereby the font size for the annotations is fixed. It is then much easier to figure out how large a particular annotation must be before laying out the graph. That ought to make it much easier to leave enough room for axis labels and such. Ideally in this mode the automatic layout would be improved so that axis labels were always visible. But even if that was a planned feature that was not initially implemented, having fixed font size would allow users to more easily lay things out as desired. -- Russell |
From: Daniel H. <dh...@gm...> - 2010-12-14 19:24:55
|
I'm using it too, with excellent results. Thanks JJ! On Tue, Dec 14, 2010 at 2:13 PM, C M <cmp...@gm...> wrote: > >> >> >> On Thu, Sep 30, 2010 at 7:55 AM, Jae-Joon Lee <lee...@gm...>wrote: >> >>> On Thu, Sep 23, 2010 at 10:31 AM, C M <cmp...@gm...> wrote: >>> > Until a more permanent solution is figured out, can anyone recommend >>> > any workarounds, even if they are a little clunky? I'm embedding mpl >>> > plots in wxPython and am also finding this issue suboptimal. >>> > >>> > Che >>> > >>> >>> A (partial) workaround is possible using the axes_grid1 toolkit (i.e., >>> you need matplotlib 1.0). >>> Attached is a module I just cooked up (based on my previous attempt @ >>> >>> http://www.mail-archive.com/mat...@li.../msg18129.html >>> ), >>> and it seems to work quite well. >>> The usage is simple. >>> >>> >>> ax = plt.axes([0,0,1,1]) >>> >>> ax.set_yticks([0.5]) >>> ax.set_yticklabels(["very long label"]) >>> >>> make_axes_area_auto_adjustable(ax) # This is where axes_grid1 >>> comes in >>> >>> Then, the axes area(including ticklabels and axis label) will be >>> automatically adjusted to fit in the given extent ([0, 0, 1, 1] in the >>> above case). >>> >>> While this is mainly for a single axes plot, you may use it with >>> multi-axes plot (but somewhat trickier to use). A few examples are >>> included in the module. >>> >>> Regards, >>> >>> -JJ >>> >> >> This thread is a few months old now, but I just wanted to mention that I >> am using JJ's workaround (thanks!) in my app--with either one or two y >> axes--and it is just excellent. >> >> This should definitely be at least an option for matplotlib users--the >> quality of the appearance of the plots now is like night and day, because, >> to me, seeing a plot without its axes labels (I'm talking about in a >> resizable plot embedded in an application, not a static graph for inclusion >> in a publication) is a *major* look and feel demerit. >> >> Che >> >> >> >> >> ------------------------------------------------------------------------------ >> Lotusphere 2011 >> Register now for Lotusphere 2011 and learn how >> to connect the dots, take your collaborative environment >> to the next level, and enter the era of Social Business. >> http://p.sf.net/sfu/lotusphere-d2d >> _______________________________________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> >> > > > -- > Daniel Hyams > dh...@gm... > -- Daniel Hyams dh...@gm... |
From: Jae-Joon L. <lee...@gm...> - 2010-12-19 03:39:14
|
Glad to hear that others find that code useful. I just want to emphasize that this is not a general solution and never meant to. Although I'm planning to include this functionality into the axes_grid1 toolkit, I don't think this will be integrated with the main matplolib. Regards, -JJ On Wed, Dec 15, 2010 at 4:24 AM, Daniel Hyams <dh...@gm...> wrote: > I'm using it too, with excellent results. Thanks JJ! > > >> On Tue, Dec 14, 2010 at 2:13 PM, C M <cmp...@gm...> wrote: >>> >>> >>> On Thu, Sep 30, 2010 at 7:55 AM, Jae-Joon Lee <lee...@gm...> >>> wrote: >>>> >>>> On Thu, Sep 23, 2010 at 10:31 AM, C M <cmp...@gm...> wrote: >>>> > Until a more permanent solution is figured out, can anyone recommend >>>> > any workarounds, even if they are a little clunky? I'm embedding mpl >>>> > plots in wxPython and am also finding this issue suboptimal. >>>> > >>>> > Che >>>> > >>>> >>>> A (partial) workaround is possible using the axes_grid1 toolkit (i.e., >>>> you need matplotlib 1.0). >>>> Attached is a module I just cooked up (based on my previous attempt @ >>>> >>>> http://www.mail-archive.com/mat...@li.../msg18129.html), >>>> and it seems to work quite well. >>>> The usage is simple. >>>> >>>> >>>> ax = plt.axes([0,0,1,1]) >>>> >>>> ax.set_yticks([0.5]) >>>> ax.set_yticklabels(["very long label"]) >>>> >>>> make_axes_area_auto_adjustable(ax) # This is where axes_grid1 >>>> comes in >>>> >>>> Then, the axes area(including ticklabels and axis label) will be >>>> automatically adjusted to fit in the given extent ([0, 0, 1, 1] in the >>>> above case). >>>> >>>> While this is mainly for a single axes plot, you may use it with >>>> multi-axes plot (but somewhat trickier to use). A few examples are >>>> included in the module. >>>> >>>> Regards, >>>> >>>> -JJ >>> >>> This thread is a few months old now, but I just wanted to mention that I >>> am using JJ's workaround (thanks!) in my app--with either one or two y >>> axes--and it is just excellent. >>> >>> This should definitely be at least an option for matplotlib users--the >>> quality of the appearance of the plots now is like night and day, because, >>> to me, seeing a plot without its axes labels (I'm talking about in a >>> resizable plot embedded in an application, not a static graph for inclusion >>> in a publication) is a *major* look and feel demerit. >>> >>> Che >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Lotusphere 2011 >>> Register now for Lotusphere 2011 and learn how >>> to connect the dots, take your collaborative environment >>> to the next level, and enter the era of Social Business. >>> http://p.sf.net/sfu/lotusphere-d2d >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >> >> >> >> -- >> Daniel Hyams >> dh...@gm... > > > > > -- > Daniel Hyams > dh...@gm... > > ------------------------------------------------------------------------------ > Lotusphere 2011 > Register now for Lotusphere 2011 and learn how > to connect the dots, take your collaborative environment > to the next level, and enter the era of Social Business. > http://p.sf.net/sfu/lotusphere-d2d > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Michael D. <md...@st...> - 2011-05-13 13:29:14
|
figtext will let you place text relative to the figure, not the axes: http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.figtext Cheers, Mike On 05/13/2011 08:46 AM, Johannes Radinger wrote: > Hej > > > I want to include a mathematical expression but want to position it > outside the graphs box. I want it above the graph, so i tried to set it as title but there is to less space between the title and the graphs box. > > how can that be done? how to set a position outside the box? > > I tried eg: > > plt.title(r'$F(x)=p*\frac{1}{s1\sqrt{2\pi}}$', fontsize=20) > > thanks > > /johannes > -- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA |
From: Johannes R. <JRa...@gm...> - 2011-05-13 13:58:46
|
Hello again I tried: plt.figtext(0, 1.2, r'$F(x)=p*\frac{1}{s1\sqrt{2\pi}}$', fontsize=20) but then the text is outside the printed area and therefore not displayed. Does that mean that the printed area has to be changed as well? /j -------- Original-Nachricht -------- > Datum: Fri, 13 May 2011 09:27:24 -0400 > Von: Michael Droettboom <md...@st...> > An: mat...@li... > Betreff: Re: [Matplotlib-users] Text outside the graphs "box" > figtext will let you place text relative to the figure, not the axes: > > http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.figtext > > Cheers, > Mike > > On 05/13/2011 08:46 AM, Johannes Radinger wrote: > > Hej > > > > > > I want to include a mathematical expression but want to position it > > outside the graphs box. I want it above the graph, so i tried to set it > as title but there is to less space between the title and the graphs box. > > > > how can that be done? how to set a position outside the box? > > > > I tried eg: > > > > plt.title(r'$F(x)=p*\frac{1}{s1\sqrt{2\pi}}$', fontsize=20) > > > > thanks > > > > /johannes > > > > > -- > Michael Droettboom > Science Software Branch > Space Telescope Science Institute > Baltimore, Maryland, USA > > > ------------------------------------------------------------------------------ > Achieve unprecedented app performance and reliability > What every C/C++ and Fortran developer should know. > Learn how Intel has extended the reach of its next-generation tools > to help boost performance applications - inlcuding clusters. > http://p.sf.net/sfu/intel-dev2devmay > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- NEU: FreePhone - kostenlos mobil telefonieren und surfen! Jetzt informieren: http://www.gmx.net/de/go/freephone |
From: Pauli V. <pa...@ik...> - 2011-05-13 14:03:44
|
Fri, 13 May 2011 15:58:37 +0200, Johannes Radinger wrote: > Hello again I tried: > > plt.figtext(0, 1.2, r'$F(x)=p*\frac{1}{s1\sqrt{2\pi}}$', fontsize=20) > > but then the text is outside the printed area and therefore not > displayed. Does that mean that the printed area has to be changed as > well? The first two parameters are the x and y coordinates of the text, in range [0, 1]. Adjust them to put the text inside the figure. |
From: Johannes R. <jra...@gm...> - 2011-05-15 14:49:14
|
How is the space between the axis and the outer margins of a figure defined? How much space is between the upper most plot and the upper end of the figure? This is the space e.g for the titles etc. but can this be space be increased? Or how can a some text be placed above the axis but with a lot of space? I hope it is now clearer... /johannes Am 13.05.2011 um 16:59 schrieb Michael Droettboom: > I think there's a confusion of definition here: > > figure: The entire image > > axes: A box within the figure containing a plot > > Mike > > On 05/13/2011 10:20 AM, Johannes Radinger wrote: >> That is not what I want, to put the text inside the figure. >> >> I want the text above the figure with some space (e.g 2 cm) to the figure >> thats why I tried 0, 1.2 but then the text is outside the margins >> >> /j >> -------- Original-Nachricht -------- >> >>> Datum: Fri, 13 May 2011 14:03:16 +0000 (UTC) >>> Von: Pauli Virtanen<pa...@ik...> >>> An: mat...@li... >>> Betreff: Re: [Matplotlib-users] Text outside the graphs "box" >>> >> >>> Fri, 13 May 2011 15:58:37 +0200, Johannes Radinger wrote: >>> >>>> Hello again I tried: >>>> >>>> plt.figtext(0, 1.2, r'$F(x)=p*\frac{1}{s1\sqrt{2\pi}}$', fontsize=20) >>>> >>>> but then the text is outside the printed area and therefore not >>>> displayed. Does that mean that the printed area has to be changed as >>>> well? >>>> >>> The first two parameters are the x and y coordinates of the text, >>> in range [0, 1]. Adjust them to put the text inside the figure. >>> >>> >>> ------------------------------------------------------------------------------ >>> Achieve unprecedented app performance and reliability >>> What every C/C++ and Fortran developer should know. >>> Learn how Intel has extended the reach of its next-generation tools >>> to help boost performance applications - inlcuding clusters. >>> http://p.sf.net/sfu/intel-dev2devmay >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >> > > > -- > Michael Droettboom > Science Software Branch > Space Telescope Science Institute > Baltimore, Maryland, USA > > > ------------------------------------------------------------------------------ > Achieve unprecedented app performance and reliability > What every C/C++ and Fortran developer should know. > Learn how Intel has extended the reach of its next-generation tools > to help boost performance applications - inlcuding clusters. > http://p.sf.net/sfu/intel-dev2devmay > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Goyo <goy...@gm...> - 2011-05-16 20:10:57
|
2011/5/15 Johannes Radinger <jra...@gm...>: > How is the space between the axis and the outer margins of a figure defined? > How much space is between the upper most plot and the upper end of the figure? > This is the space e.g for the titles etc. but can this be space be increased? Use subplots_adjust. Goyo |