summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorRoss Barnowski <rossbar@berkeley.edu>2020-10-16 14:11:16 -0700
committerGitHub <noreply@github.com>2020-10-16 14:11:16 -0700
commit824d4bc281c93f463ac1d937f32a029da80a6e22 (patch)
tree407f360507aff936ef1197e4f6ecd76dd681d459 /examples
parent864f1b8a610215e574867a61a5b83c1c44403bd6 (diff)
downloadnetworkx-824d4bc281c93f463ac1d937f32a029da80a6e22.tar.gz
Update "house with colors" gallery example (#4263)
* Fix axes so that nodes are fully contained in figure. * Change node color scheme. * Switch to tableau color scheme
Diffstat (limited to 'examples')
-rw-r--r--examples/drawing/plot_house_with_colors.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/examples/drawing/plot_house_with_colors.py b/examples/drawing/plot_house_with_colors.py
index add6c0b1..c3a2809d 100644
--- a/examples/drawing/plot_house_with_colors.py
+++ b/examples/drawing/plot_house_with_colors.py
@@ -12,8 +12,15 @@ G = nx.house_graph()
# explicitly set positions
pos = {0: (0, 0), 1: (1, 0), 2: (0, 1), 3: (1, 1), 4: (0.5, 2.0)}
-nx.draw_networkx_nodes(G, pos, node_size=2000, nodelist=[4])
-nx.draw_networkx_nodes(G, pos, node_size=3000, nodelist=[0, 1, 2, 3], node_color="b")
+# Plot nodes with different properties for the "wall" and "roof" nodes
+nx.draw_networkx_nodes(
+ G, pos, node_size=3000, nodelist=[0, 1, 2, 3], node_color="tab:blue"
+)
+nx.draw_networkx_nodes(G, pos, node_size=2000, nodelist=[4], node_color="tab:orange")
nx.draw_networkx_edges(G, pos, alpha=0.5, width=6)
+# Customize axes
+ax = plt.gca()
+ax.margins(0.11)
+plt.tight_layout()
plt.axis("off")
plt.show()