def _lowerlimit_symbol(c, x_pt, y_pt, size_pt, attrs): c.draw( path.path(path.moveto_pt(x_pt - 0.5 * size_pt, y_pt), path.lineto_pt(x_pt + 0.5 * size_pt, y_pt)), attrs) c.draw( path.path(path.moveto_pt(x_pt, y_pt), path.lineto_pt(x_pt, y_pt + 2.0 * size_pt)), attrs + [dcfpyx.deco.earrow(size=size_pt * dcfpyx.unit.v_pt)])
def paint(self, canvas, data, axis, axispos): if self.breaklinesattrs is not None: breaklinesdist_pt = unit.topt(self.breaklinesdist) breaklineslength_pt = unit.topt(self.breaklineslength) breaklinesextent_pt = (0.5*breaklinesdist_pt*math.fabs(self.cos) + 0.5*breaklineslength_pt*math.fabs(self.sin)) if canvas.extent_pt < breaklinesextent_pt: canvas.extent_pt = breaklinesextent_pt for v in [data.subaxes[name].vminover for name in data.names[1:]]: # use a tangent of the basepath (this is independent of the tickdirection) p = axispos.vbasepath(v, None).normpath() breakline = p.tangent(0, length=self.breaklineslength) widthline = p.tangent(0, length=self.breaklinesdist).transformed(trafomodule.rotate(self.breaklinesangle+90, *breakline.atbegin())) # XXX Uiiii tocenter = map(lambda x: 0.5*(x[0]-x[1]), zip(breakline.atbegin(), breakline.atend())) towidth = map(lambda x: 0.5*(x[0]-x[1]), zip(widthline.atbegin(), widthline.atend())) breakline = breakline.transformed(trafomodule.translate(*tocenter).rotated(self.breaklinesangle, *breakline.atbegin())) breakline1 = breakline.transformed(trafomodule.translate(*towidth)) breakline2 = breakline.transformed(trafomodule.translate(-towidth[0], -towidth[1])) canvas.fill(path.path(path.moveto_pt(*breakline1.atbegin_pt()), path.lineto_pt(*breakline1.atend_pt()), path.lineto_pt(*breakline2.atend_pt()), path.lineto_pt(*breakline2.atbegin_pt()), path.closepath()), [color.gray.white]) canvas.stroke(breakline1, self.defaultbreaklinesattrs + self.breaklinesattrs) canvas.stroke(breakline2, self.defaultbreaklinesattrs + self.breaklinesattrs) _title.paint(self, canvas, data, axis, axispos)
def updatepath(self, path, trafo, context): sbx = context.t1stack.pop(0) wx = context.t1stack.pop(0) path.append(moveto_pt(*trafo.apply_pt(sbx, 0))) context.x = sbx context.y = 0 context.wx = wx context.wy = 0
def xvgridpath(self, vx): return path.path(path.moveto_pt(*self.vpos_pt(vx, 0, 0)), path.lineto_pt(*self.vpos_pt(vx, 1, 0)), path.lineto_pt(*self.vpos_pt(vx, 1, 1)), path.lineto_pt(*self.vpos_pt(vx, 0, 1)), path.closepath())
def updatepath(self, path, trafo, context): x = context.t1stack.pop(0) y = context.t1stack.pop(0) path.append(moveto_pt(*trafo.apply_pt(x, y))) context.x = x context.y = y
def updatepath(self, path, trafo, context): dy = context.t1stack.pop(0) path.append(moveto_pt(*trafo.apply_pt(context.x, context.y + dy))) context.y += dy
def updatepath(self, path, trafo, context): path.append(closepath()) # The closepath in T1 is different from PostScripts in that it does # *not* modify the current position; hence we need to add an additional # moveto here ... path.append(moveto_pt(*trafo.apply_pt(context.x, context.y)))
def zvgridpath(self, vz): return path.path(path.moveto_pt(*self.vpos_pt(0, 0, vz)), path.lineto_pt(*self.vpos_pt(1, 0, vz)), path.lineto_pt(*self.vpos_pt(1, 1, vz)), path.lineto_pt(*self.vpos_pt(0, 1, vz)), path.closepath())
def _lowerlimit_symbol(c, x_pt, y_pt, size_pt, attrs): c.draw(path.path(path.moveto_pt(x_pt-0.5*size_pt, y_pt ), path.lineto_pt(x_pt+0.5*size_pt, y_pt )), attrs) c.draw(path.path(path.moveto_pt(x_pt , y_pt ), path.lineto_pt(x_pt , y_pt+2.0*size_pt )), attrs+[dcfpyx.deco.earrow(size=size_pt*dcfpyx.unit.v_pt)])
def yvgridpath(self, vy): return path.path(path.moveto_pt(*self.vpos_pt(0, vy, 0)), path.lineto_pt(*self.vpos_pt(1, vy, 0)), path.lineto_pt(*self.vpos_pt(1, vy, 1)), path.lineto_pt(*self.vpos_pt(0, vy, 1)), path.closepath())