Re: [matplotlib-devel] Exploring
I don't think this is just an issue of "bbox_inches" option. For example, if you create an axes of rect=[0,0,1,1] and save the figure (w/o bbox_inches option), you will see a similar behavior. Also, I believe that the result depends on the backends. I think this kind of issue is quite difficult to resolve and I doubt if this will be solved anytime soon. Any contribution will be very much appreciated. Regards, -JJ On Sat, Jul 31, 2010 at 5:48 AM, Damon McDougall wrote: > Aha! Even without the text, i.e. setting label1On = False for all the major > ticks, the behaviour I see is that with bbox_inches = 'tight' and pad_inches > = 0.0 I get the saved figure which includes the black border line for the > bottom and left edges, but not the top and right edges. This may have > something to do with it. Maybe it's an issue with the bounding box not being > 'inclusive' and leaving out the end points? > > Regards, > -- Damon > > -- > Damon McDougall > Mathematics Institute > University of Warwick > Coventry > CV4 7AL > d.mcdoug...@warwick.ac.uk > > > > On 30 Jul 2010, at 20:33, Eric Firing wrote: > >> On 07/30/2010 06:32 AM, Damon McDougall wrote: >>> Hmm, it seems as though tick labels get clipped on the top and on the right >>> when passing bbox_inches='tight' and pad_inches=0.0. I wouldn't expect this >>> behaviour. Is there perhaps a bug in Bbox.union that's causing this? >>> >> >> Not likely. Much more likely is a problem in calculating the rendered >> size of the text. >> >> Eric >> >>> Regards, >>> -- Damon >>> >>> -- >>> Damon McDougall >>> Mathematics Institute >>> University of Warwick >>> Coventry >>> CV4 7AL >>> d.mcdoug...@warwick.ac.uk >>> >>> >>> >>> On 30 Jul 2010, at 16:03, Tony S Yu wrote: >>> On Jul 30, 2010, at 10:54 AM, Damon McDougall wrote: > Hi, > > I'm interested in fiddling around with the matplotlib source. Let's say > we set up various things: > > from matplotlib.figure import Figure() > from matplotlib.backends.backend_pdf import FigureCanvasPdf as > FigureCanvas > > fig = Figure() > canvas = FigureCanvas(fig) > ax = fig.add_subplot(1, 1, 1) > fig.savefig('asd.pdf', bbox_inches='tight') > > I would like to know what exactly happens when bbox_inches='tight' is > passed to savefig(). I've been searching in the figure.py source and > nowhere can I see the bbox_inches='tight' keyword being tested for in the > savefig() method. Having said that, all of the kwargs do get passed on to > the canvas.print_figure() method, so I looked in the backend_pdf.py file > but couldn't find a print_figure() method. Could someone point me in the > right direction? > > Regards, > -- Damon That's funny: I was just looking at bbox_inches='tight' recently. You'll find the relevant section in matplotlib.backend_bases.print_figure. Best, -Tony >>> >>> >>> -- >>> The Palm PDK Hot Apps Program offers developers who use the >>> Plug-In Development Kit to bring their C/C++ apps to Palm for a share >>> of $1 Million in cash or HP Products. Visit us here for more details: >>> http://p.sf.net/sfu/dev2dev-palm >>> ___ >>> Matplotlib-devel mailing list >>> Matplotlib-devel@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel >> >> >> -- >> The Palm PDK Hot Apps Program offers developers who use the >> Plug-In Development Kit to bring their C/C++ apps to Palm for a share >> of $1 Million in cash or HP Products. Visit us here for more details: >> http://p.sf.net/sfu/dev2dev-palm >> ___ >> Matplotlib-devel mailing list >> Matplotlib-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > > > -- > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > ___ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourcefo
Re: [matplotlib-devel] Exploring
Aha! Even without the text, i.e. setting label1On = False for all the major ticks, the behaviour I see is that with bbox_inches = 'tight' and pad_inches = 0.0 I get the saved figure which includes the black border line for the bottom and left edges, but not the top and right edges. This may have something to do with it. Maybe it's an issue with the bounding box not being 'inclusive' and leaving out the end points? Regards, -- Damon -- Damon McDougall Mathematics Institute University of Warwick Coventry CV4 7AL d.mcdoug...@warwick.ac.uk On 30 Jul 2010, at 20:33, Eric Firing wrote: > On 07/30/2010 06:32 AM, Damon McDougall wrote: >> Hmm, it seems as though tick labels get clipped on the top and on the right >> when passing bbox_inches='tight' and pad_inches=0.0. I wouldn't expect this >> behaviour. Is there perhaps a bug in Bbox.union that's causing this? >> > > Not likely. Much more likely is a problem in calculating the rendered > size of the text. > > Eric > >> Regards, >> -- Damon >> >> -- >> Damon McDougall >> Mathematics Institute >> University of Warwick >> Coventry >> CV4 7AL >> d.mcdoug...@warwick.ac.uk >> >> >> >> On 30 Jul 2010, at 16:03, Tony S Yu wrote: >> >>> >>> On Jul 30, 2010, at 10:54 AM, Damon McDougall wrote: >>> Hi, I'm interested in fiddling around with the matplotlib source. Let's say we set up various things: from matplotlib.figure import Figure() from matplotlib.backends.backend_pdf import FigureCanvasPdf as FigureCanvas fig = Figure() canvas = FigureCanvas(fig) ax = fig.add_subplot(1, 1, 1) fig.savefig('asd.pdf', bbox_inches='tight') I would like to know what exactly happens when bbox_inches='tight' is passed to savefig(). I've been searching in the figure.py source and nowhere can I see the bbox_inches='tight' keyword being tested for in the savefig() method. Having said that, all of the kwargs do get passed on to the canvas.print_figure() method, so I looked in the backend_pdf.py file but couldn't find a print_figure() method. Could someone point me in the right direction? Regards, -- Damon >>> >>> That's funny: I was just looking at bbox_inches='tight' recently. You'll >>> find the relevant section in matplotlib.backend_bases.print_figure. >>> >>> Best, >>> -Tony >>> >> >> >> -- >> The Palm PDK Hot Apps Program offers developers who use the >> Plug-In Development Kit to bring their C/C++ apps to Palm for a share >> of $1 Million in cash or HP Products. Visit us here for more details: >> http://p.sf.net/sfu/dev2dev-palm >> ___ >> Matplotlib-devel mailing list >> Matplotlib-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel > > > -- > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > ___ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Exploring
On 07/30/2010 06:32 AM, Damon McDougall wrote: > Hmm, it seems as though tick labels get clipped on the top and on the right > when passing bbox_inches='tight' and pad_inches=0.0. I wouldn't expect this > behaviour. Is there perhaps a bug in Bbox.union that's causing this? > Not likely. Much more likely is a problem in calculating the rendered size of the text. Eric > Regards, > -- Damon > > -- > Damon McDougall > Mathematics Institute > University of Warwick > Coventry > CV4 7AL > d.mcdoug...@warwick.ac.uk > > > > On 30 Jul 2010, at 16:03, Tony S Yu wrote: > >> >> On Jul 30, 2010, at 10:54 AM, Damon McDougall wrote: >> >>> Hi, >>> >>> I'm interested in fiddling around with the matplotlib source. Let's say we >>> set up various things: >>> >>> from matplotlib.figure import Figure() >>> from matplotlib.backends.backend_pdf import FigureCanvasPdf as FigureCanvas >>> >>> fig = Figure() >>> canvas = FigureCanvas(fig) >>> ax = fig.add_subplot(1, 1, 1) >>> fig.savefig('asd.pdf', bbox_inches='tight') >>> >>> I would like to know what exactly happens when bbox_inches='tight' is >>> passed to savefig(). I've been searching in the figure.py source and >>> nowhere can I see the bbox_inches='tight' keyword being tested for in the >>> savefig() method. Having said that, all of the kwargs do get passed on to >>> the canvas.print_figure() method, so I looked in the backend_pdf.py file >>> but couldn't find a print_figure() method. Could someone point me in the >>> right direction? >>> >>> Regards, >>> -- Damon >> >> That's funny: I was just looking at bbox_inches='tight' recently. You'll >> find the relevant section in matplotlib.backend_bases.print_figure. >> >> Best, >> -Tony >> > > > -- > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > ___ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Exploring
Hmm, it seems as though tick labels get clipped on the top and on the right when passing bbox_inches='tight' and pad_inches=0.0. I wouldn't expect this behaviour. Is there perhaps a bug in Bbox.union that's causing this? Regards, -- Damon -- Damon McDougall Mathematics Institute University of Warwick Coventry CV4 7AL d.mcdoug...@warwick.ac.uk On 30 Jul 2010, at 16:03, Tony S Yu wrote: > > On Jul 30, 2010, at 10:54 AM, Damon McDougall wrote: > >> Hi, >> >> I'm interested in fiddling around with the matplotlib source. Let's say we >> set up various things: >> >> from matplotlib.figure import Figure() >> from matplotlib.backends.backend_pdf import FigureCanvasPdf as FigureCanvas >> >> fig = Figure() >> canvas = FigureCanvas(fig) >> ax = fig.add_subplot(1, 1, 1) >> fig.savefig('asd.pdf', bbox_inches='tight') >> >> I would like to know what exactly happens when bbox_inches='tight' is passed >> to savefig(). I've been searching in the figure.py source and nowhere can I >> see the bbox_inches='tight' keyword being tested for in the savefig() >> method. Having said that, all of the kwargs do get passed on to the >> canvas.print_figure() method, so I looked in the backend_pdf.py file but >> couldn't find a print_figure() method. Could someone point me in the right >> direction? >> >> Regards, >> -- Damon > > That's funny: I was just looking at bbox_inches='tight' recently. You'll find > the relevant section in matplotlib.backend_bases.print_figure. > > Best, > -Tony > -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Exploring
On Jul 30, 2010, at 10:54 AM, Damon McDougall wrote: > Hi, > > I'm interested in fiddling around with the matplotlib source. Let's say we > set up various things: > > from matplotlib.figure import Figure() > from matplotlib.backends.backend_pdf import FigureCanvasPdf as FigureCanvas > > fig = Figure() > canvas = FigureCanvas(fig) > ax = fig.add_subplot(1, 1, 1) > fig.savefig('asd.pdf', bbox_inches='tight') > > I would like to know what exactly happens when bbox_inches='tight' is passed > to savefig(). I've been searching in the figure.py source and nowhere can I > see the bbox_inches='tight' keyword being tested for in the savefig() method. > Having said that, all of the kwargs do get passed on to the > canvas.print_figure() method, so I looked in the backend_pdf.py file but > couldn't find a print_figure() method. Could someone point me in the right > direction? > > Regards, > -- Damon That's funny: I was just looking at bbox_inches='tight' recently. You'll find the relevant section in matplotlib.backend_bases.print_figure. Best, -Tony -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] Exploring
On Fri, Jul 30, 2010 at 9:54 AM, Damon McDougall wrote: > Hi, > > I'm interested in fiddling around with the matplotlib source. Let's say we > set up various things: > > from matplotlib.figure import Figure() > from matplotlib.backends.backend_pdf import FigureCanvasPdf as FigureCanvas > > fig = Figure() > canvas = FigureCanvas(fig) > ax = fig.add_subplot(1, 1, 1) > fig.savefig('asd.pdf', bbox_inches='tight') > > I would like to know what exactly happens when bbox_inches='tight' is > passed to savefig(). I've been searching in the figure.py source and nowhere > can I see the bbox_inches='tight' keyword being tested for in the savefig() > method. Having said that, all of the kwargs do get passed on to the > canvas.print_figure() method, so I looked in the backend_pdf.py file but > couldn't find a print_figure() method. Could someone point me in the right > direction? > > Regards, > -- Damon > > That is because the FigureCanvasPdf class inherits from the FigureCanvasBase, which defines the .savefig() function. You will find that in backend_bases.py. I hope this helps, Ben Root -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] Exploring
Hi, I'm interested in fiddling around with the matplotlib source. Let's say we set up various things: from matplotlib.figure import Figure() from matplotlib.backends.backend_pdf import FigureCanvasPdf as FigureCanvas fig = Figure() canvas = FigureCanvas(fig) ax = fig.add_subplot(1, 1, 1) fig.savefig('asd.pdf', bbox_inches='tight') I would like to know what exactly happens when bbox_inches='tight' is passed to savefig(). I've been searching in the figure.py source and nowhere can I see the bbox_inches='tight' keyword being tested for in the savefig() method. Having said that, all of the kwargs do get passed on to the canvas.print_figure() method, so I looked in the backend_pdf.py file but couldn't find a print_figure() method. Could someone point me in the right direction? Regards, -- Damon -- Damon McDougall Mathematics Institute University of Warwick Coventry CV4 7AL d.mcdoug...@warwick.ac.uk -- The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel