Skip to content

Commit 86b252c

Browse files
committed
doc(plot): use |pydot.Dot| link subst; minor improvs
1 parent 2b417c7 commit 86b252c

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

docs/source/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ Here's how to install::
4646

4747
pip install graphtik
4848

49-
OR with dependencies for plotting support (and you need to install `Graphviz
50-
<https://graphviz.org>`_ program separately with your OS tools)::
49+
OR with dependencies for plotting support (and you need to install `Graphviz`_ program
50+
separately with your OS tools)::
5151

5252
pip install graphtik[plot]
5353

docs/source/plotting.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ If you want all details, plot the solution::
6060
solution.net.plot(...)
6161

6262
.. Note::
63-
For plots, `Graphviz <https://graphviz.org>`_ program must be in your PATH,
63+
For plots, `Graphviz`_ program must be in your PATH,
6464
and ``pydot`` & ``matplotlib`` python packages installed.
6565
You may install both when installing ``graphtik`` with its ``plot`` extras::
6666

6767
pip install graphtik[plot]
6868

6969
.. Tip::
70-
The `pydot.Dot <https://pypi.org/project/pydot/>`_ instances returned by
70+
The |pydot.Dot|_ instances returned by
7171
:meth:`.Plottable.plot()` are rendered directly in *Jupyter/IPython* notebooks
7272
as SVG images.
7373

@@ -139,8 +139,7 @@ directive from :mod:`.sphinxext` module to embed graph-plots into your generated
139139
- an instance of :class:`.Plottable` (such as :class:`.NetworkOperation`,
140140
:class:`.Network`, :class:`.ExecutionPlan` or :class:`.Solution`);
141141
142-
- an already plotted ``pydot.Dot`` instance, ie, the result of a :meth:`.plot()` call
143-
(see `pydot <https://github.com/pydot/pydot>`_ project).
142+
- an already plotted |pydot.Dot|_ instance, ie, the result of a :meth:`.plot()` call
144143
145144
If missing, it renders the last variable in the doctest code assigned with
146145
the above types.
@@ -231,7 +230,7 @@ which you may :graphtik:`reference <addmul-anchor>` with this syntax:
231230
.. hint::
232231
In this case, the ``:graphvar:`` parameter is not really needed, since
233232
the code contains just one variable assignment receiving a subclass
234-
of :class:`.Plottable` or :class:`pydot.Dot` instance.
233+
of :class:`.Plottable` or |pydot.Dot|_ instance.
235234

236235
Additionally, the doctest code producing the *plottable* does not have to be contained
237236
in the *graphtik* directive.

graphtik/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,12 @@ def plot(
259259
a URL to the *graphtik* legend; if it evaluates to false, none is added.
260260
261261
:return:
262-
a `pydot.Dot <https://pypi.org/project/pydot/>`_ instance
262+
a |pydot.Dot|_ instance
263263
(for for API reference visit:
264264
https://pydotplus.readthedocs.io/reference.html#pydotplus.graphviz.Dot)
265265
266266
.. Tip::
267-
The :class:`pydot.Dot` instance returned is rendered directly
267+
The |pydot.Dot|_ instance returned is rendered directly
268268
in *Jupyter/IPython* notebooks as SVG images.
269269
270270
You may increase the height of the SVG cell output with

graphtik/plot.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ def build_pydot(
205205
legend_url="https://graphtik.readthedocs.io/en/latest/_images/GraphtikLegend.svg",
206206
) -> pydot.Dot:
207207
"""
208-
Build a *Graphviz* out of a Network graph/steps/inputs/outputs and return it.
208+
Build a |pydot.Dot|_ out of a Network graph/steps/inputs/outputs and return it
209+
210+
to be fed into `Graphviz`_ to render.
209211
210212
See :meth:`.Plottable.plot()` for the arguments, sample code, and
211213
the legend of the plots.
@@ -387,10 +389,10 @@ def supported_plot_formats() -> List[str]:
387389

388390
def render_pydot(dot: pydot.Dot, filename=None, show=False, jupyter_render: str = None):
389391
"""
390-
Plot a *Graphviz* dot in a matplotlib, in file or return it for Jupyter.
392+
Render a |pydot.Dot|_ instance with `Graphviz`_ in a file/matplotlib or return it for Jupyter.
391393
392394
:param dot:
393-
the pre-built *Graphviz* :class:`pydot.Dot` instance
395+
the pre-built |pydot.Dot|_ instance
394396
:param str filename:
395397
Write diagram into a file.
396398
Common extensions are ``.png .dot .jpg .jpeg .pdf .svg``
@@ -409,7 +411,8 @@ def render_pydot(dot: pydot.Dot, filename=None, show=False, jupyter_render: str
409411
netop.plot(jupyter_render={"svg_element_styles": "height: 600px; width: 100%"})
410412
411413
:return:
412-
the matplotlib image if ``show=-1``, or the `dot`.
414+
the matplotlib image if ``show=-1``, or the given `dot` annotated with any
415+
jupyter-rendering configurations given in `jupyter_render` parameter.
413416
414417
See :meth:`.Plottable.plot()` for sample code.
415418
"""

0 commit comments

Comments
 (0)