Skip to content

Commit

Permalink
Merge remote-tracking branch 'igraph/develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
iosonofabio committed Sep 22, 2023
2 parents 8f4b516 + caa34dc commit a753e4e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions doc/examples_sphinx-gallery/spanning_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,8 @@
edge_width=g.es["width"]
)
plt.show()

# %%
# .. note::
# To invert the y axis such that the root of the tree is on top of the plot,
# you can call `ax.invert_yaxis()` before `plt.show()`.
5 changes: 5 additions & 0 deletions doc/source/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,11 @@ If you prefer to use `matplotlib`_ as a plotting engine, create an axes and use
:alt: The visual representation of our social network (matplotlib backend)
:align: center

.. note::
When plotting rooted trees, Cairo automatically puts the root on top of the image and
the leaves at the bottom. For `matplotlib`_, the root is usually at the bottom instead.
You can easily place the root on top by calling `ax.invert_yaxis()`.

Hmm, this is not too pretty so far. A trivial addition would be to use the names as the
vertex labels and to color the vertices according to the gender. Vertex labels are taken
from the ``label`` attribute by default and vertex colors are determined by the
Expand Down
5 changes: 5 additions & 0 deletions doc/source/visualisation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ You can then further manipulate the axes and figure however you like via the `ax
called them). This variant does not use `Cairo`_ directly and might be lacking some features that are available in the
`Cairo`_ backend: please open an issue on Github to request specific features.

.. note::
When plotting rooted trees, Cairo automatically puts the root on top of the image and
the leaves at the bottom. For `matplotlib`_, the root is usually at the bottom instead.
You can easily place the root on top by calling `ax.invert_yaxis()`.

Plotting via `matplotlib`_ makes it easy to combine igraph with other plots. For instance, if you want to have a figure
with two panels showing different aspects of some data set, say a graph and a bar plot, you can easily do that::

Expand Down

0 comments on commit a753e4e

Please sign in to comment.