-
-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gh-38798: adding method tikz to class Graph
Currently, we can create a TikzPicture from a graph as follows, but is raises an experimental feature warning: ``` sage: from sage.misc.latex_standalone import TikzPicture sage: g = graphs.PetersenGraph() sage: t = TikzPicture.from_graph(g) <ipython-input-20-c4b6306d5e76>:1: FutureWarning: This class/method/function is marked as experimental. It, its functionality or its interface might change without a formal deprecation. See #20343 for details. t = TikzPicture.from_graph(g) sage: t ``` It was declared experimental during the review of #20343 because it should rather be a method of the class Graph. This is what we do in this PR: we add a tikz method to the class Graph. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation - [ ] and checked the documentation preview. ### ⌛ Dependencies None ### Screenshots As a consequence, the following now works in Jupyter. By default, it uses the dot2tex format if dot2tex is available: ![image](https://github.com/user-attachments/assets/ff3c1ffb-46ae-46bf- bf64-f26cc3f93941) ### Works well with sagetex For example: ``` \begin{sagesilent} g = graphs.PetersenGraph() tikz = g.tikz() \end{sagesilent} \begin{center} \sageplot[scale=.5][pdf]{tikz} \end{center} ``` URL: #38798 Reported by: Sébastien Labbé Reviewer(s): David Coudert, Frédéric Chapoton, Sébastien Labbé, Xavier Caruso
- Loading branch information
Showing
1 changed file
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters