#20343: Adding sage/misc/tikzpicture.py
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:
  slabbe                 |       Status:  needs_review
           Type:         |    Milestone:  sage-7.2
  enhancement            |   Resolution:
       Priority:  major  |    Merged in:
      Component:  misc   |    Reviewers:
       Keywords:         |  Work issues:
        Authors:         |       Commit:
  Sébastien Labbé        |  4ae7f63de1517e4c483e500757989b6efde5b785
Report Upstream:  N/A    |     Stopgaps:
         Branch:         |
  u/slabbe/20343         |
   Dependencies:         |
-------------------------+-------------------------------------------------
Description changed by slabbe:

Old description:

> Importing `TikzPicture` class from my optional Sage package
> [https://github.com/seblabbe/slabbe slabbe-0.2.spkg] into Sage.
>
> One example:
>
> {{{
> sage: from sage.misc.tikzpicture import TikzPicture
> sage: V =
> [[1,0,1],[1,0,0],[1,1,0],[0,0,-1],[0,1,0],[-1,0,0],[0,1,1],[0,0,1],[0,-1,0]]
> sage: P = Polyhedron(vertices=V).polar()
> sage: s = P.projection().tikz([674,108,-731],112)
> sage: t = TikzPicture(s)
> sage: t.pdf()
> }}}
>
> Second example:
>
> {{{
> sage: g = graphs.PetersenGraph()
> sage: %time _ = TikzPicture(latex(g), standalone_configs=["border=4mm"],
> packages=['tkz-graph']).pdf()
> CPU times: user 3.52 ms, sys: 12.7 ms, total: 16.2 ms
> Wall time: 2.24 s
> }}}
>
> compared to using view (which crops the vertices and creates two pages
> pdf on mac):
>
> {{{
> sage: %time view(g, tightpage=True)
> CPU times: user 126 ms, sys: 85 ms, total: 211 ms
> Wall time: 6.06 s
> }}}
>
> Also, if dot2tex and graphviz available:
>
> {{{
> sage: t = TikzPicture.from_graph(g, prog='dot')  # optional: dot2tex
> }}}

New description:

 Importing `TikzPicture` class from my optional Sage package
 [https://github.com/seblabbe/slabbe slabbe-0.2.spkg] into Sage.

 One example:

 {{{
 sage: from sage.misc.tikzpicture import TikzPicture
 sage: V =
 [[1,0,1],[1,0,0],[1,1,0],[0,0,-1],[0,1,0],[-1,0,0],[0,1,1],[0,0,1],[0,-1,0]]
 sage: P = Polyhedron(vertices=V).polar()
 sage: s = P.projection().tikz([674,108,-731],112)
 sage: t = TikzPicture(s)
 sage: t.pdf()
 }}}

 Second example:

 {{{
 sage: g = graphs.PetersenGraph()
 sage: %time _ = TikzPicture(latex(g), standalone_options=["border=4mm"],
 usepackage=['tkz-graph']).pdf()
 CPU times: user 3.52 ms, sys: 12.7 ms, total: 16.2 ms
 Wall time: 2.24 s
 }}}

 compared to using view (which crops the vertices and creates two pages pdf
 on mac):

 {{{
 sage: %time view(g, tightpage=True)
 CPU times: user 126 ms, sys: 85 ms, total: 211 ms
 Wall time: 6.06 s
 }}}

 Also, if dot2tex and graphviz available:

 {{{
 sage: t = TikzPicture.from_graph(g, prog='dot')  # optional: dot2tex
 }}}

--

--
Ticket URL: <http://trac.sagemath.org/ticket/20343#comment:9>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to