def paint(self, canvas, data, axis, axispos): if axis.title is not None and self.titleattrs is not None: x, y = axispos.vtickpoint_pt(self.titlepos) dx, dy = axispos.vtickdirection(self.titlepos) titleattrs = self.defaulttitleattrs + self.titleattrs if self.titledirection is not None: titleattrs.append(self.titledirection.trafo(dx, dy)) title = canvas.text_pt(x, y, axis.title, titleattrs) canvas.extent_pt += unit.topt(self.titledist) title.linealign_pt(canvas.extent_pt, -dx, -dy) canvas.extent_pt += title.extent_pt(dx, dy)
def paint(self, canvas, data, axis, axispos): if axis.title is not None and self.titleattrs is not None: x, y = axispos.vtickpoint_pt(self.titlepos) dx, dy = axispos.vtickdirection(self.titlepos) titleattrs = self.defaulttitleattrs + self.titleattrs if self.titledirection is not None: x2, y2 = axispos.vtickpoint_pt(self.titlepos+0.001) # XXX: axisdirection needed dx2, dy2 = x2-x, y2-y if dx*dy2-dy*dx2 < 0: dy2 *= -1 dx2 *= -1 titleattrs.append(self.titledirection.trafo(dy2, -dx2)) title = canvas.text_pt(x, y, axis.title, titleattrs) canvas.extent_pt += unit.topt(self.titledist) title.linealign_pt(canvas.extent_pt, -dx, -dy) canvas.extent_pt += title.extent_pt(dx, dy)