Beginner's question using PyX in Python 3.8.1.
I'm creating an EPS file, and would like the canvas size to be 70 mm x 70 mm. How can I do this?
from pyx import *
# build and size canvas
c = canvas.canvas()
c.fill(path.circle(2.5, 1.5, 0.5))
c.writeEPSfile("my-output")
print("Done!")
The .eps file that I get is the size of the element that I've added, but I would like it to be a 70 mm square. Any help appreciated!
The bounding box is a property of the
page(see document.page). In thewriteEPSfilemethod page parameters can be set by thepage_prefix (see writeEPSfile documentation), hence the following code creates the requested output:Note that the
bboxmodule is not part of the default module names imported by*, thus a second import line is required.