import math as maths import os from pypyx.pypyx import colour, pic p = pic(scale=.15) x = 0 def pos(): global x x += 1 return (0, x) p.op().stroked(colour.red()).text(pos(), 'red') p.op().stroked(colour.orange()).text(pos(), 'orange') p.op().stroked(colour.yellow()).text(pos(), 'yellow') p.op().stroked(colour.lime()).text(pos(), 'lime') p.op().stroked(colour.green()).text(pos(), 'green') p.op().stroked(colour.cyan()).text(pos(), 'cyan') p.op().stroked(colour.blue()).text(pos(), 'blue') p.op().stroked(colour.magenta()).text(pos(), 'magenta') p.op().stroked(colour.white()).text(pos(), 'white') p.op().stroked(colour.black()).text(pos(), 'black') p.op().stroked(colour.purple()).text(pos(), 'purple') p.op().stroked(colour.brown()).text(pos(), 'brown') p.op().stroked(colour.pink()).text(pos(), 'pink') p.op().stroked(colour.dark_grey()).text(pos(), 'dark grey')
p.op().line((3 * tau / 4, -tick), (3 * tau / 4, 0)) p.op().below().text((3 * tau / 4, -tick), r"$3\tau/4$") p.op().line((tau, -tick), (tau, 0)) p.op().below().text((tau, -tick * 2), r"$\tau$") p.op().line((-tick, 1), (0, 1)) p.op().to_left().text((-tick, 1), r"$1$") p.op().line((-tick, -1), (0, -1)) p.op().to_left().text((-tick, -1), r"$-1$") p.op().stroked(colour.green()).smooth_poly_curve([(0, 0), (tau / 4, 1)], start_angle=deg(45), finish_angle=deg(0)) p.op().stroked(colour.green()).smooth_poly_curve( [(tau / 4, 1), (tau / 2, 0)], start_angle=deg(0), finish_angle=deg(-45) ) p.op().stroked(colour.red()).smooth_poly_curve( [(tau / 2, 0), (3 * tau / 4, -1), (tau, 0)], start_angle=deg(-45), finish_angle=deg(45) ) # p.op().dashed().stroked(colour.pink()).curve ( # [ # (0, 0), # (tau/4, 1), # (tau/2, 0), # #(3*tau/4, -1), # #(tau, 0), # ], # start_angle = deg(45), # finish_angle = deg(-45) # )
from __future__ import division import math as maths import os from pypyx.pypyx import colour, pic p = pic (scale = .15) x = 0 def pos (): global x x += 1 return (0, x) p.op().stroked(colour.red()).text (pos(), 'red') p.op().stroked(colour.orange()).text (pos(), 'orange') p.op().stroked(colour.yellow()).text (pos(), 'yellow') p.op().stroked(colour.lime()).text (pos(),'lime') p.op().stroked(colour.green()).text (pos(), 'green') p.op().stroked(colour.cyan()).text (pos(), 'cyan') p.op().stroked(colour.blue()).text (pos(), 'blue') p.op().stroked(colour.magenta()).text (pos(), 'magenta') p.op().stroked(colour.white()).text (pos(), 'white') p.op().stroked(colour.black()).text (pos(), 'black') p.op().stroked(colour.purple()).text (pos(), 'purple') p.op().stroked(colour.brown()).text (pos(), 'brown') p.op().stroked(colour.pink()).text (pos(), 'pink') p.op().stroked(colour.dark_grey()).text (pos(), 'dark grey')