ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 06 Feb 2021 13:30:39 +0100Export a Plot as Tikz to Latexhttps://ask.sagemath.org/question/55592/export-a-plot-as-tikz-to-latex/Hello,
a couple of days ago I drew a Polyhedra in sage cell Server and exported it as a Tikz file.
like this:
P1 = Polyhedron(vertices = [[0,0,0], [1,2,1], [-4,-3,-2],[3,3,-2],[1,-4,3],[-2,2,1]])
P1.tikz([-0.0946,-0.4796,-0.8724],160.47, axis=true, opacity=0.25)
Now I got an Arrangement of Hyperplanes like:
H3.<x,y,z> = HyperplaneArrangements(QQ)
A = H3([(1,2,1), 0], [(-4,-3,-2), 0],[(3,3,-2), 0], [(1,-4,3), 0],[(-2,2,1), 0])
that I want to export as a Tikz file but it seems that this is not possible. Or am I just doesnt find it?
Anyone there that can maybe help me?
Best regards
Lars KrollFri, 05 Feb 2021 22:27:03 +0100https://ask.sagemath.org/question/55592/export-a-plot-as-tikz-to-latex/Comment by FrédéricC for <p>Hello,</p>
<p>a couple of days ago I drew a Polyhedra in sage cell Server and exported it as a Tikz file.
like this: </p>
<p>P1 = Polyhedron(vertices = [[0,0,0], [1,2,1], [-4,-3,-2],[3,3,-2],[1,-4,3],[-2,2,1]])
P1.tikz([-0.0946,-0.4796,-0.8724],160.47, axis=true, opacity=0.25)</p>
<p>Now I got an Arrangement of Hyperplanes like:
H3.<x,y,z> = HyperplaneArrangements(QQ)
A = H3([(1,2,1), 0], [(-4,-3,-2), 0],[(3,3,-2), 0], [(1,-4,3), 0],[(-2,2,1), 0])
that I want to export as a Tikz file but it seems that this is not possible. Or am I just doesnt find it?
Anyone there that can maybe help me?</p>
<p>Best regards</p>
<p>Lars Kroll</p>
https://ask.sagemath.org/question/55592/export-a-plot-as-tikz-to-latex/?comment=55602#post-id-55602That's because nobody has written the tikz method for hyperplane arrangement. Open source means that you can do it yourself to provide that for everybody else.Sat, 06 Feb 2021 13:30:39 +0100https://ask.sagemath.org/question/55592/export-a-plot-as-tikz-to-latex/?comment=55602#post-id-55602Answer by Emmanuel Charpentier for <p>Hello,</p>
<p>a couple of days ago I drew a Polyhedra in sage cell Server and exported it as a Tikz file.
like this: </p>
<p>P1 = Polyhedron(vertices = [[0,0,0], [1,2,1], [-4,-3,-2],[3,3,-2],[1,-4,3],[-2,2,1]])
P1.tikz([-0.0946,-0.4796,-0.8724],160.47, axis=true, opacity=0.25)</p>
<p>Now I got an Arrangement of Hyperplanes like:
H3.<x,y,z> = HyperplaneArrangements(QQ)
A = H3([(1,2,1), 0], [(-4,-3,-2), 0],[(3,3,-2), 0], [(1,-4,3), 0],[(-2,2,1), 0])
that I want to export as a Tikz file but it seems that this is not possible. Or am I just doesnt find it?
Anyone there that can maybe help me?</p>
<p>Best regards</p>
<p>Lars Kroll</p>
https://ask.sagemath.org/question/55592/export-a-plot-as-tikz-to-latex/?answer=55595#post-id-55595`A.plot()` is inherently a 3D object. Its `save` method can save to various 2D image formats (but not `.pgf`), HTML or various specialized 3D formats. Its `save_image` method does not include `.pgf` as a valid output format.
Your best bet seems to start from one of these formats (or HTML) and convert it via the targe tool(s) for the choosen format. It might be possible to het `three.js` to output a Tikz picture...
It might also be possible to add Tikz output to the relevant `save_image` (or possibly `save`) method. Care to file a ticket for this ?Sat, 06 Feb 2021 09:40:14 +0100https://ask.sagemath.org/question/55592/export-a-plot-as-tikz-to-latex/?answer=55595#post-id-55595