From: Darren D. <dsd...@gm...> - 2011-02-25 00:18:40
|
On Tue, Feb 22, 2011 at 4:23 AM, Daniel Mader <dan...@go...> wrote: > 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? > > An example follows to demonstrate, thanks in advance I use matplotlib for this purpose pretty frequently. A few tricks: from http://matplotlib.sourceforge.net/users/customizing.html : # note that font.size controls default text sizes. To configure # special text sizes tick labels, axes, labels, title, etc, see the rc # settings for axes and ticks. Special text sizes can be defined # relative to font.size, using the following values: xx-small, x-small, # small, medium, large, x-large, xx-large, larger, or smaller # specify the figure canvas size, in inches figure(figsize=(3.4, 4)) # place the axes in the figure window # specifying (left, bottom, width, height) as fraction of figure size # adjust those positions to make enough room for tick and axis labels axes([0.15, 0.12, 0.8, 0.83]) Specify the dpi for you screen, so the figure rendered on your screen is the correct size. This is figure.dpi, best to set it in matplotlibrc. Darren |