예제 #1
0
 def testExp(self):
     ticks = [tick((-1, 10), labellevel=0), tick((1, 1), labellevel=0), tick((10, 1), labellevel=0)]
     exponential().labels(ticks)
     self.assertEqual([t.label for t in ticks], [r"{-10^{-1}}", r"{10^{0}}", r"{10^{1}}"])
     ticks = [tick((0, 1), labellevel=0), tick((1, -10), labellevel=0), tick((15, 100), labellevel=0)]
     exponential(mantissatexter=decimal(equalprecision=1)).labels(ticks)
     self.assertEqual([t.label for t in ticks], [r"{0.0}", r"{{-1.0}\cdot10^{-1}}", r"{{1.5}\cdot10^{-1}}"])
예제 #2
0
파일: test_axis.py 프로젝트: mjg/PyX-svn
                        direction=-1))
c.insert(pathaxis(path.path(path.moveto(1, 0), path.lineto(1, 8)),
                        lin(**lintest)))
c.insert(pathaxis(path.path(path.moveto(5, 0), path.lineto(5, 8)),
                        lin(painter=regular(labelattrs=[trafo.rotate(45)], titleattrs=[trafo.rotate(45)]), **lintest),
                        direction=-1))
c.insert(pathaxis(path.path(path.moveto(8, 0), path.lineto(8, 8)),
                        lin(painter=regular(labelattrs=[trafo.rotate(45), text.halign.right], titleattrs=[trafo.rotate(-45)]), **lintest),
                        direction=-1))
c.insert(pathaxis(path.path(path.moveto(11, 0), path.lineto(11, 8)),
                        lin(painter=regular(tickattrs=[color.rgb.red], innerticklength=0, outerticklength=ticklength.normal), **lintest),
                        direction=-1))
c.insert(pathaxis(path.path(path.moveto(12, 0), path.lineto(12, 8)),
                        lin(painter=regular(tickattrs=[attr.changelist([None, color.rgb.green])]), **lintest)))
c.insert(pathaxis(path.path(path.moveto(16, 0), path.lineto(16, 8)),
                        lin(texter=exponential(), **lintest),
                        direction=-1))
c.insert(pathaxis(path.path(path.moveto(18, 0), path.lineto(18, 8)),
                        lin(texter=rational(), **lintest),
                        direction=-1))
lintest = {"title": "axis title", "min": -2*math.pi, "max": 0, "divisor": math.pi, "parter": linparter(["0.25"])}
c.insert(pathaxis(path.path(path.moveto(0, 11), path.lineto(8, 11)),
                        lin(texter=rational(suffix="\pi"), **lintest)))
lintest = {"title": "axis title", "min": 0, "max": 2*math.pi, "divisor": math.pi, "parter": linparter(["0.5"])}
c.insert(pathaxis(path.path(path.moveto(10, 11), path.lineto(18, 11)),
                        lin(texter=rational(numsuffix="\pi", over="%s/%s"), **lintest)))
lintest = {"min": 0, "max": 2*math.pi, "divisor": math.pi, "parter": linparter(["0.125"])}
c.insert(pathaxis(path.circle(4, 17, 4),
                        lin(texter=rational(suffix="\pi"), **lintest)))
lintest = {"min": 0, "max": 2*math.pi, "divisor": math.pi/180, "parter": linparter(["30"])}
c.insert(pathaxis(path.circle(14, 17, 4),
예제 #3
0
c.insert(
    pathaxis(path.path(path.moveto(11, 0), path.lineto(11, 8)),
             lin(painter=regular(tickattrs=[color.rgb.red],
                                 innerticklength=0,
                                 outerticklength=ticklength.normal),
                 **lintest),
             direction=-1))
c.insert(
    pathaxis(
        path.path(path.moveto(12, 0), path.lineto(12, 8)),
        lin(painter=regular(
            tickattrs=[attr.changelist([None, color.rgb.green])]),
            **lintest)))
c.insert(
    pathaxis(path.path(path.moveto(16, 0), path.lineto(16, 8)),
             lin(texter=exponential(), **lintest),
             direction=-1))
c.insert(
    pathaxis(path.path(path.moveto(18, 0), path.lineto(18, 8)),
             lin(texter=rational(), **lintest),
             direction=-1))
lintest = {
    "title": "axis title",
    "min": -2 * math.pi,
    "max": 0,
    "divisor": math.pi,
    "parter": linparter(["0.25"])
}
c.insert(
    pathaxis(path.path(path.moveto(0, 11), path.lineto(8, 11)),
             lin(texter=rational(suffix="\pi"), **lintest)))