I am trying to use matplotlib to prepare some numbers for publication. So that the font size matches the text of the manuscript, I start by first creating a figure in the final size so that I do not reduce the figure when I insert it into the manuscript.
The problem I ran into is that since the number is then quite small, I can scale the font sizes, axis sizes, line widths, etc., but what I couldn’t understand was scaling dotted or dashed lines, as well as the thickness of the border frame of the legend. For a simplified and somewhat exaggerated example, consider
#!/usr/bin/python small = True from matplotlib import use use('pdf') from matplotlib import rc rc('ps', usedistiller='xpdf') rc('text', usetex=True) if small: figsize = (1.0, 0.5) rc('font', size=2) rc('axes', labelsize=2, linewidth=0.2) rc('legend', fontsize=2, handlelength=10) rc('xtick', labelsize=2) rc('ytick', labelsize=2) rc('lines', lw=0.2, mew=0.2) rc('grid', linewidth=0.2) else: figsize = (8,8) import numpy as np x = np.arange(0, 10, 0.001) y = np.sin(x) import matplotlib.pyplot as plt f = plt.figure(figsize=figsize) a = f.add_subplot(111) a.plot(x, y, '--', label='foo bar') a.legend() f.savefig('mplt.pdf')
If you change the first executable line to small = False , you will see how it should look in the “normal” size. Compared to the usual size, the small plot suffers from a legend window with too thick borders, and the dotted line is too rough, that is, dashes are too long and the distance between strokes is too long.
So my question is: is there a way to fix these two problems?
The used version of matplotlib is 0.99.1.2.