Skip to content

Commit a95e22f

Browse files
committed
doc: clarify specification of same color for all vertices when plotting
1 parent beefef0 commit a95e22f

File tree

3 files changed

+130
-4
lines changed

3 files changed

+130
-4
lines changed

doc/source/sg_execution_times.rst

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
2+
:orphan:
3+
4+
.. _sphx_glr_sg_execution_times:
5+
6+
7+
Computation times
8+
=================
9+
**00:10.013** total execution time for 25 files **from all galleries**:
10+
11+
.. container::
12+
13+
.. raw:: html
14+
15+
<style scoped>
16+
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet" />
17+
<link href="https://cdn.datatables.net/1.13.6/css/dataTables.bootstrap5.min.css" rel="stylesheet" />
18+
</style>
19+
<script src="https://code.jquery.com/jquery-3.7.0.js"></script>
20+
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
21+
<script src="https://cdn.datatables.net/1.13.6/js/dataTables.bootstrap5.min.js"></script>
22+
<script type="text/javascript" class="init">
23+
$(document).ready( function () {
24+
$('table.sg-datatable').DataTable({order: [[1, 'desc']]});
25+
} );
26+
</script>
27+
28+
.. list-table::
29+
:header-rows: 1
30+
:class: table table-striped sg-datatable
31+
32+
* - Example
33+
- Time
34+
- Mem (MB)
35+
* - :ref:`sphx_glr_tutorials_visualize_cliques.py` (``../examples_sphinx-gallery/visualize_cliques.py``)
36+
- 00:02.970
37+
- 0.0
38+
* - :ref:`sphx_glr_tutorials_ring_animation.py` (``../examples_sphinx-gallery/ring_animation.py``)
39+
- 00:01.287
40+
- 0.0
41+
* - :ref:`sphx_glr_tutorials_cluster_contraction.py` (``../examples_sphinx-gallery/cluster_contraction.py``)
42+
- 00:00.759
43+
- 0.0
44+
* - :ref:`sphx_glr_tutorials_betweenness.py` (``../examples_sphinx-gallery/betweenness.py``)
45+
- 00:00.735
46+
- 0.0
47+
* - :ref:`sphx_glr_tutorials_visual_style.py` (``../examples_sphinx-gallery/visual_style.py``)
48+
- 00:00.711
49+
- 0.0
50+
* - :ref:`sphx_glr_tutorials_delaunay-triangulation.py` (``../examples_sphinx-gallery/delaunay-triangulation.py``)
51+
- 00:00.504
52+
- 0.0
53+
* - :ref:`sphx_glr_tutorials_configuration.py` (``../examples_sphinx-gallery/configuration.py``)
54+
- 00:00.416
55+
- 0.0
56+
* - :ref:`sphx_glr_tutorials_online_user_actions.py` (``../examples_sphinx-gallery/online_user_actions.py``)
57+
- 00:00.332
58+
- 0.0
59+
* - :ref:`sphx_glr_tutorials_erdos_renyi.py` (``../examples_sphinx-gallery/erdos_renyi.py``)
60+
- 00:00.313
61+
- 0.0
62+
* - :ref:`sphx_glr_tutorials_connected_components.py` (``../examples_sphinx-gallery/connected_components.py``)
63+
- 00:00.216
64+
- 0.0
65+
* - :ref:`sphx_glr_tutorials_complement.py` (``../examples_sphinx-gallery/complement.py``)
66+
- 00:00.201
67+
- 0.0
68+
* - :ref:`sphx_glr_tutorials_generate_dag.py` (``../examples_sphinx-gallery/generate_dag.py``)
69+
- 00:00.194
70+
- 0.0
71+
* - :ref:`sphx_glr_tutorials_visualize_communities.py` (``../examples_sphinx-gallery/visualize_communities.py``)
72+
- 00:00.176
73+
- 0.0
74+
* - :ref:`sphx_glr_tutorials_bridges.py` (``../examples_sphinx-gallery/bridges.py``)
75+
- 00:00.169
76+
- 0.0
77+
* - :ref:`sphx_glr_tutorials_spanning_trees.py` (``../examples_sphinx-gallery/spanning_trees.py``)
78+
- 00:00.161
79+
- 0.0
80+
* - :ref:`sphx_glr_tutorials_isomorphism.py` (``../examples_sphinx-gallery/isomorphism.py``)
81+
- 00:00.153
82+
- 0.0
83+
* - :ref:`sphx_glr_tutorials_quickstart.py` (``../examples_sphinx-gallery/quickstart.py``)
84+
- 00:00.142
85+
- 0.0
86+
* - :ref:`sphx_glr_tutorials_minimum_spanning_trees.py` (``../examples_sphinx-gallery/minimum_spanning_trees.py``)
87+
- 00:00.137
88+
- 0.0
89+
* - :ref:`sphx_glr_tutorials_simplify.py` (``../examples_sphinx-gallery/simplify.py``)
90+
- 00:00.079
91+
- 0.0
92+
* - :ref:`sphx_glr_tutorials_bipartite_matching_maxflow.py` (``../examples_sphinx-gallery/bipartite_matching_maxflow.py``)
93+
- 00:00.073
94+
- 0.0
95+
* - :ref:`sphx_glr_tutorials_articulation_points.py` (``../examples_sphinx-gallery/articulation_points.py``)
96+
- 00:00.067
97+
- 0.0
98+
* - :ref:`sphx_glr_tutorials_topological_sort.py` (``../examples_sphinx-gallery/topological_sort.py``)
99+
- 00:00.058
100+
- 0.0
101+
* - :ref:`sphx_glr_tutorials_bipartite_matching.py` (``../examples_sphinx-gallery/bipartite_matching.py``)
102+
- 00:00.058
103+
- 0.0
104+
* - :ref:`sphx_glr_tutorials_shortest_path_visualisation.py` (``../examples_sphinx-gallery/shortest_path_visualisation.py``)
105+
- 00:00.052
106+
- 0.0
107+
* - :ref:`sphx_glr_tutorials_maxflow.py` (``../examples_sphinx-gallery/maxflow.py``)
108+
- 00:00.052
109+
- 0.0

doc/source/tutorial.es.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ Especificación de colores en los gráficos
701701

702702
***Nombres de colores X11***
703703

704-
Consulta la `lista de nombres de colores X11 <https://en.wikipedia.org/wiki/X11_color_names>`_ en Wikipedia para ver la lista completa. Los nombres de los colores no distinguen entre mayúsculas y minúsculas en |igraph|, por lo que "DarkBLue" puede escribirse también como "darkblue".
704+
Consulta la `lista de nombres de colores X11 <https://en.wikipedia.org/wiki/X11_color_names>`_ en Wikipedia para ver la lista completa. Los nombres de los colores no distinguen entre mayúsculas y minúsculas en |igraph|, por lo que ``"DarkBLue"`` puede escribirse también como ``"darkblue"``.
705705

706706
***Especificación del color en la sintaxis CSS***
707707

doc/source/tutorial.rst

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -895,9 +895,9 @@ color (e.g., edge, vertex or label colors in the respective attributes):
895895
X11 color names
896896
See the `list of X11 color names <https://en.wikipedia.org/wiki/X11_color_names>`_
897897
in Wikipedia for the complete list. Alternatively you can see the
898-
keys of the igraph.drawing.colors.known_colors dictionary. Color
899-
names are case insensitive in igraph so "DarkBlue" can be written as
900-
"darkblue" as well.
898+
keys of the ``igraph.drawing.colors.known_colors`` dictionary. Color
899+
names are case insensitive in igraph so ``"DarkBlue"`` can be written as
900+
``"darkblue"`` as well.
901901

902902
Color specification in CSS syntax
903903
This is a string according to one of the following formats (where *R*, *G* and
@@ -913,6 +913,23 @@ Color specification in CSS syntax
913913
Lists or tuples of RGB values in the range 0-1
914914
Example: ``(1.0, 0.5, 0)`` or ``[1.0, 0.5, 0]``.
915915

916+
Note that when specifying the same color for all vertices or edges, you can use
917+
a string as-is but not the tuple or list syntax as tuples or lists would be
918+
interpreted as if the *items* in the tuple are for individual vertices or
919+
edges. So, this would work::
920+
921+
>>> ig.plot(g, vertex_color="green")
922+
923+
But this would not, as it would treat the items in the tuple as palette indices
924+
for the first, second and third vertoces::
925+
926+
>>> ig.plot(g, vertex_color=(1, 0, 0))
927+
928+
In this latter case, you need to expand the color specification for each vertex
929+
explicitly::
930+
931+
>>> ig.plot(g, vertex_color=[(1, 0, 0)] * g.vcount())
932+
916933

917934
Saving plots
918935
^^^^^^^^^^^^

0 commit comments

Comments
 (0)