Basic Drawing

Let’s start by looking at a very simple PySketcher sketch which draws a single line:

import pysketcher as ps
from pysketcher.backend.matplotlib import MatplotlibBackend

figure = ps.Figure(0.0, 5.0, 0.0, 5.0, MatplotlibBackend)

a = ps.Point(1.0, 3.0)
b = ps.Point(4.0, 3.0)

line = ps.Line(a, b)
figure.add(line)
figure.show()


This draws the image shown here:

../_images/basic_drawing_1.png