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,
Daniel

import numpy,pylab,matplotlib.ticker as mtick

x = numpy.linspace(0,10,1000)
y = numpy.exp(x)

pylab.rcdefaults()

fig = pylab.figure()
ax = fig.add_subplot(111)
ax.set_yscale('log')
ax.yaxis.set_major_formatter(mtick.FormatStrFormatter('%d'))
ax.set_xlabel('asdf')
ax.set_ylabel('qwer')
ax.plot(x,y)
fig.savefig('example_mpl-ticker_1')

pylab.rcParams['figure.figsize'] = 5,3
pylab.rcParams['font.size'] = 12

fig = pylab.figure()
ax = fig.add_subplot(111)
ax.set_yscale('log')
ax.yaxis.set_major_formatter(mtick.FormatStrFormatter('%d'))
ax.set_xlabel('asdf')
ax.set_ylabel('qwer')
ax.plot(x,y)
fig.savefig('example_mpl-ticker_2')

------------------------------------------------------------------------------
Index, Search & Analyze Logs and other IT data in Real-Time with Splunk 
Collect, index and harness all the fast moving IT data generated by your 
applications, servers and devices whether physical, virtual or in the cloud.
Deliver compliance at lower cost and gain new business insights. 
Free Software Download: http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to