Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Generating Tikz codes from Sage for drawing scattering points in 3D

I am a beginner in Sage and Tikz, and have written the following snippet of Sage code:

P = Polyhedron(ieqs=[(30, -2, -2, -1), (25, -1.5, -2, -3),(20,-2,-1,-1), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1)])
pts = P.integral_points()
point3d(pts,rgbcolor=(1,0, 0), size=10) + P.plot(rgbcolor = 'yellow', opacity = 0.5)

The purpose of the codes is to generate the integral points interior to the polytopes bound by 6 inequalities as given in the codes. The output is in the following link:

www.cse.cuhk.edu.hk/~jlee/dots.png

I tried to follow the following reference:

doc.sagemath.org/html/en/thematic_tutorials/polytope_tikz.html

to generate Tikz codes for LaTeX and failed. Unlike Polyhedron which is a kind of object that can respond to "projection", point3d generates only a Graphics3D object which doesn't understand "projection".

Is there any way to output these points to Tikz?

Also, is it possible to ask Sage to color each of the facets of the polytope in different colors (just like Tikz can)?

Many thanx in advance!