-
-
Notifications
You must be signed in to change notification settings - Fork 487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding method tikz to class Graph #38798
Conversation
Documentation preview for this PR (built with commit 2a5b4d7; changes) is ready! 🎉 |
ac7cb63
to
24c4e9c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it and it is a nice addition.
…in set_options method already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is much better and the examples are very nice (on my laptop).
- ``rankdir`` -- string (default: ``'down'``), direction of graph layout | ||
when prog is ``'dot'``, possible values are ``'down'``, | ||
``'up'``, ``'right'`` and ``'left'``. | ||
- ``subgraph_clusters`` -- (default: ``[]``) a list of lists of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default is None
, not []
. The same for other parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None gets replaced by []
. This is why I write that the default is []
. I don't set the default argument to the empty list due to the gotcha related to doing this (https://docs.python-guide.org/writing/gotchas/).
If you insist that I replace []
by None
and that I add a sentence after saying that None
gets replaced by []
, then I can.
the linter is not happy, please fix the offending line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Si j'ai ajouté Xavier comme reviewer, c'était pas pour mettre de la pression. C'est que j'étais dans son bureau et qu'il était curieux de tester aussi. Dans tous les cas, merci pour la relecture! |
Pas de souci, et il ne faut pas qu'il hésite à revenir en arrière si il trouve qu'un truc ne va pas. |
Non, tout va bien, c'est parfait. |
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 sagemath#20343 for details. t = TikzPicture.from_graph(g) sage: t ``` It was declared experimental during the review of sagemath#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) URL: sagemath#38798 Reported by: Sébastien Labbé Reviewer(s): David Coudert, Frédéric Chapoton, Sébastien Labbé, Xavier Caruso
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 sagemath#20343 for details. t = TikzPicture.from_graph(g) sage: t ``` It was declared experimental during the review of sagemath#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) URL: sagemath#38798 Reported by: Sébastien Labbé Reviewer(s): David Coudert, Frédéric Chapoton, Sébastien Labbé, Xavier Caruso
tikz method for graphs was recently added in sagemath#38798 default value for `format` should be `None` as documented. ### ⌛ Dependencies sagemath#38798 URL: sagemath#38847 Reported by: Sébastien Labbé Reviewer(s): David Coudert, Frédéric Chapoton
tikz method for graphs was recently added in sagemath#38798 default value for `format` should be `None` as documented. ### ⌛ Dependencies sagemath#38798 URL: sagemath#38847 Reported by: Sébastien Labbé Reviewer(s): David Coudert, Frédéric Chapoton
Currently, we can create a TikzPicture from a graph as follows, but is raises an experimental feature warning:
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
⌛ Dependencies
None
Screenshots
As a consequence, the following now works in Jupyter. By default, it uses the dot2tex format if dot2tex is available:
Works well with sagetex
For example: