pgfPicture(mypict,filename)
If the filename is without a .tex suffix, it will be added.
The source of this document is in /build/reproducible-path/macaulay2-1.25.06+ds/M2/Macaulay2/packages/Graphics.m2:1880:0.