From: Goyo <goy...@gm...> - 2011-02-24 22:49:12
|
2011/2/22 Daniel Mader <dan...@go...>: > Hi, > > there has been a similar question recently but I couldn't figure out > if or how this is solved: > > I'd like to reduce the figure size so that I can add it to a LaTeX > document without scaling (PDF output with LaTeX font rendering). For > that, I need to adapt the font sizes, too. > > Unfortunately, the canvas is not properly scaled so that the axis > labels and the possibly the tick marks are cut off. > > Is this a bug, feature, design flaw? How can I properly work around > it, i.e. reduce the graph automatically for a given figsize/font size > combination so that everything fits on the figure? You'll have to understand how dimensions are calculated and then use stuff like Figure.subplots_adjust. http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.Figure.subplots_adjust http://matplotlib.sourceforge.net/api/figure_api.html#matplotlib.figure.SubplotParams http://matplotlib.sourceforge.net/faq/howto_faq.html#automatically-make-room-for-tick-labels As a fast and dirty trick you can pass big numbers to subplots_adjust and then use bbox_inches='tight' in savefig. Goyo |