Hello,

Using the Cairo backend with the following snippet:

from matplotlib.figure import Figure
from matplotlib.artist import setp
from matplotlib.backends.backend_agg import FigureCanvasAgg
from matplotlib.backends.backend_cairo import FigureCanvasCairo
import numpy as np

fig = Figure()
ax1 = fig.add_axes([0.1, 0.1, 0.8, 0.8])
x = np.arange(0, 10, 0.2)

ax1.plot(x, np.sin(x))
ax1.xaxis.set_ticklabels(['Apr', 'Jul', 'Oct', '\'12', 'Apr', 'Jul'])
setp(ax1.yaxis.get_ticklabels(), visible=False)

FigureCanvasCairo(fig).print_figure('test.png')


Results in the x-axis tick labels being significantly displaced.
Specifically, "Oct" and "'12" are positioned far closer to the axis than
either "Apr" or "Jul".

With the AGG backend all of the labels are roughly aligned to the
baseline of the font -- give or take a pixel.

I have observed this on a Gentoo and Debian system, both running 1.1.1,
albeit with different default fonts.

Although I am not completely sure it appears as if a label contains a
glyph that extends below the baseline, e.g. 'p' or 'J', that the label
is forced away from the axis.

Can anyone suggest a workaround for this (or explain where I am going
wrong)?

Regards, Freddie.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to