We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Getting 403 Forbidden errors when running plot_custom_node_icons example
The way `plot_custom_node_icons` is currently set up, we grab resources from `materialsui.com` every time anyone runs this example which of course includes our own CI runs. We are now getting 403 forbidden errors (rightly so) since we are accessing these resources programatically. I can think of 2 ways around this:
 1) Store the icon png's locally so we're not constantly having to download them from an external source
 2) Add header spoofing to the url request.

Though it makes the example a bit larger, I prefer option 1). The second option would add boilerplate to the example, and isn't exactly setting an example of good web citizenship. I'm certainly open to other ideas though!

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `examples/drawing/plot_custom_node_icons.py`
Content:
```
1 """
2 =================
3 Custom node icons
4 =================
5 
6 Example of using custom icons to represent nodes with matplotlib.
7 """
8 
9 import matplotlib.pyplot as plt
10 import networkx as nx
11 import PIL
12 import urllib.request
13 
14 # Image URLs for graph nodes
15 icon_urls = {
16     "router": "https://www.materialui.co/materialIcons/hardware/router_black_144x144.png",
17     "switch": "https://www.materialui.co/materialIcons/action/dns_black_144x144.png",
18     "PC": "https://www.materialui.co/materialIcons/hardware/computer_black_144x144.png",
19 }
20 
21 # Load images from web
22 images = {
23     k: PIL.Image.open(urllib.request.urlopen(url)) for k, url in icon_urls.items()
24 }
25 
26 # Generate the computer network graph
27 G = nx.Graph()
28 
29 G.add_node("router", image=images["router"])
30 for i in range(1, 4):
31     G.add_node(f"switch_{i}", image=images["switch"])
32     for j in range(1, 4):
33         G.add_node("PC_" + str(i) + "_" + str(j), image=images["PC"])
34 
35 G.add_edge("router", "switch_1")
36 G.add_edge("router", "switch_2")
37 G.add_edge("router", "switch_3")
38 for u in range(1, 4):
39     for v in range(1, 4):
40         G.add_edge("switch_" + str(u), "PC_" + str(u) + "_" + str(v))
41 
42 # get layout and draw edges
43 pos = nx.spring_layout(G)
44 fig, ax = plt.subplots()
45 nx.draw_networkx_edges(G, pos=pos, ax=ax, min_source_margin=15, min_target_margin=15)
46 
47 # Transform from data coordinates (scaled between xlim and ylim) to display coordinates
48 tr_figure = ax.transData.transform
49 # Transform from display to figure coordinates
50 tr_axes = fig.transFigure.inverted().transform
51 
52 # Select the size of the image (relative to the X axis)
53 icon_size = (ax.get_xlim()[1] - ax.get_xlim()[0]) * 0.025
54 icon_center = icon_size / 2.0
55 
56 # Add the respective image to each node
57 for n in G.nodes:
58     xf, yf = tr_figure(pos[n])
59     xa, ya = tr_axes((xf, yf))
60     # get overlapped axes and plot icon
61     a = plt.axes([xa - icon_center, ya - icon_center, icon_size, icon_size])
62     a.imshow(G.nodes[n]["image"])
63     a.axis("off")
64 plt.show()
65
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/examples/drawing/plot_custom_node_icons.py b/examples/drawing/plot_custom_node_icons.py
--- a/examples/drawing/plot_custom_node_icons.py
+++ b/examples/drawing/plot_custom_node_icons.py
@@ -4,24 +4,23 @@
 =================
 
 Example of using custom icons to represent nodes with matplotlib.
+
+Images for node icons courtesy of www.materialui.co
 """
 
 import matplotlib.pyplot as plt
 import networkx as nx
 import PIL
-import urllib.request
 
 # Image URLs for graph nodes
-icon_urls = {
-    "router": "https://www.materialui.co/materialIcons/hardware/router_black_144x144.png",
-    "switch": "https://www.materialui.co/materialIcons/action/dns_black_144x144.png",
-    "PC": "https://www.materialui.co/materialIcons/hardware/computer_black_144x144.png",
+icons = {
+    "router": "icons/router_black_144x144.png",
+    "switch": "icons/switch_black_144x144.png",
+    "PC": "icons/computer_black_144x144.png",
 }
 
-# Load images from web
-images = {
-    k: PIL.Image.open(urllib.request.urlopen(url)) for k, url in icon_urls.items()
-}
+# Load images
+images = {k: PIL.Image.open(fname) for k, fname in icons.items()}
 
 # Generate the computer network graph
 G = nx.Graph()
@@ -39,10 +38,22 @@
     for v in range(1, 4):
         G.add_edge("switch_" + str(u), "PC_" + str(u) + "_" + str(v))
 
-# get layout and draw edges
-pos = nx.spring_layout(G)
+# Get a reproducible layout and create figure
+pos = nx.spring_layout(G, seed=1734289230)
 fig, ax = plt.subplots()
-nx.draw_networkx_edges(G, pos=pos, ax=ax, min_source_margin=15, min_target_margin=15)
+
+# Note: the min_source/target_margin kwargs only work with FancyArrowPatch objects.
+# Force the use of FancyArrowPatch for edge drawing by setting `arrows=True`,
+# but suppress arrowheads with `arrowstyle="-"`
+nx.draw_networkx_edges(
+    G,
+    pos=pos,
+    ax=ax,
+    arrows=True,
+    arrowstyle="-",
+    min_source_margin=15,
+    min_target_margin=15,
+)
 
 # Transform from data coordinates (scaled between xlim and ylim) to display coordinates
 tr_figure = ax.transData.transform

{"golden_diff": "diff --git a/examples/drawing/plot_custom_node_icons.py b/examples/drawing/plot_custom_node_icons.py\n--- a/examples/drawing/plot_custom_node_icons.py\n+++ b/examples/drawing/plot_custom_node_icons.py\n@@ -4,24 +4,23 @@\n =================\n \n Example of using custom icons to represent nodes with matplotlib.\n+\n+Images for node icons courtesy of www.materialui.co\n \"\"\"\n \n import matplotlib.pyplot as plt\n import networkx as nx\n import PIL\n-import urllib.request\n \n # Image URLs for graph nodes\n-icon_urls = {\n-    \"router\": \"https://www.materialui.co/materialIcons/hardware/router_black_144x144.png\",\n-    \"switch\": \"https://www.materialui.co/materialIcons/action/dns_black_144x144.png\",\n-    \"PC\": \"https://www.materialui.co/materialIcons/hardware/computer_black_144x144.png\",\n+icons = {\n+    \"router\": \"icons/router_black_144x144.png\",\n+    \"switch\": \"icons/switch_black_144x144.png\",\n+    \"PC\": \"icons/computer_black_144x144.png\",\n }\n \n-# Load images from web\n-images = {\n-    k: PIL.Image.open(urllib.request.urlopen(url)) for k, url in icon_urls.items()\n-}\n+# Load images\n+images = {k: PIL.Image.open(fname) for k, fname in icons.items()}\n \n # Generate the computer network graph\n G = nx.Graph()\n@@ -39,10 +38,22 @@\n     for v in range(1, 4):\n         G.add_edge(\"switch_\" + str(u), \"PC_\" + str(u) + \"_\" + str(v))\n \n-# get layout and draw edges\n-pos = nx.spring_layout(G)\n+# Get a reproducible layout and create figure\n+pos = nx.spring_layout(G, seed=1734289230)\n fig, ax = plt.subplots()\n-nx.draw_networkx_edges(G, pos=pos, ax=ax, min_source_margin=15, min_target_margin=15)\n+\n+# Note: the min_source/target_margin kwargs only work with FancyArrowPatch objects.\n+# Force the use of FancyArrowPatch for edge drawing by setting `arrows=True`,\n+# but suppress arrowheads with `arrowstyle=\"-\"`\n+nx.draw_networkx_edges(\n+    G,\n+    pos=pos,\n+    ax=ax,\n+    arrows=True,\n+    arrowstyle=\"-\",\n+    min_source_margin=15,\n+    min_target_margin=15,\n+)\n \n # Transform from data coordinates (scaled between xlim and ylim) to display coordinates\n tr_figure = ax.transData.transform\n", "issue": "Getting 403 Forbidden errors when running plot_custom_node_icons example\nThe way `plot_custom_node_icons` is currently set up, we grab resources from `materialsui.com` every time anyone runs this example which of course includes our own CI runs. We are now getting 403 forbidden errors (rightly so) since we are accessing these resources programatically. I can think of 2 ways around this:\r\n 1) Store the icon png's locally so we're not constantly having to download them from an external source\r\n 2) Add header spoofing to the url request.\r\n\r\nThough it makes the example a bit larger, I prefer option 1). The second option would add boilerplate to the example, and isn't exactly setting an example of good web citizenship. I'm certainly open to other ideas though!\n", "before_files": [{"content": "\"\"\"\n=================\nCustom node icons\n=================\n\nExample of using custom icons to represent nodes with matplotlib.\n\"\"\"\n\nimport matplotlib.pyplot as plt\nimport networkx as nx\nimport PIL\nimport urllib.request\n\n# Image URLs for graph nodes\nicon_urls = {\n    \"router\": \"https://www.materialui.co/materialIcons/hardware/router_black_144x144.png\",\n    \"switch\": \"https://www.materialui.co/materialIcons/action/dns_black_144x144.png\",\n    \"PC\": \"https://www.materialui.co/materialIcons/hardware/computer_black_144x144.png\",\n}\n\n# Load images from web\nimages = {\n    k: PIL.Image.open(urllib.request.urlopen(url)) for k, url in icon_urls.items()\n}\n\n# Generate the computer network graph\nG = nx.Graph()\n\nG.add_node(\"router\", image=images[\"router\"])\nfor i in range(1, 4):\n    G.add_node(f\"switch_{i}\", image=images[\"switch\"])\n    for j in range(1, 4):\n        G.add_node(\"PC_\" + str(i) + \"_\" + str(j), image=images[\"PC\"])\n\nG.add_edge(\"router\", \"switch_1\")\nG.add_edge(\"router\", \"switch_2\")\nG.add_edge(\"router\", \"switch_3\")\nfor u in range(1, 4):\n    for v in range(1, 4):\n        G.add_edge(\"switch_\" + str(u), \"PC_\" + str(u) + \"_\" + str(v))\n\n# get layout and draw edges\npos = nx.spring_layout(G)\nfig, ax = plt.subplots()\nnx.draw_networkx_edges(G, pos=pos, ax=ax, min_source_margin=15, min_target_margin=15)\n\n# Transform from data coordinates (scaled between xlim and ylim) to display coordinates\ntr_figure = ax.transData.transform\n# Transform from display to figure coordinates\ntr_axes = fig.transFigure.inverted().transform\n\n# Select the size of the image (relative to the X axis)\nicon_size = (ax.get_xlim()[1] - ax.get_xlim()[0]) * 0.025\nicon_center = icon_size / 2.0\n\n# Add the respective image to each node\nfor n in G.nodes:\n    xf, yf = tr_figure(pos[n])\n    xa, ya = tr_axes((xf, yf))\n    # get overlapped axes and plot icon\n    a = plt.axes([xa - icon_center, ya - icon_center, icon_size, icon_size])\n    a.imshow(G.nodes[n][\"image\"])\n    a.axis(\"off\")\nplt.show()\n", "path": "examples/drawing/plot_custom_node_icons.py"}], "after_files": [{"content": "\"\"\"\n=================\nCustom node icons\n=================\n\nExample of using custom icons to represent nodes with matplotlib.\n\nImages for node icons courtesy of www.materialui.co\n\"\"\"\n\nimport matplotlib.pyplot as plt\nimport networkx as nx\nimport PIL\n\n# Image URLs for graph nodes\nicons = {\n    \"router\": \"icons/router_black_144x144.png\",\n    \"switch\": \"icons/switch_black_144x144.png\",\n    \"PC\": \"icons/computer_black_144x144.png\",\n}\n\n# Load images\nimages = {k: PIL.Image.open(fname) for k, fname in icons.items()}\n\n# Generate the computer network graph\nG = nx.Graph()\n\nG.add_node(\"router\", image=images[\"router\"])\nfor i in range(1, 4):\n    G.add_node(f\"switch_{i}\", image=images[\"switch\"])\n    for j in range(1, 4):\n        G.add_node(\"PC_\" + str(i) + \"_\" + str(j), image=images[\"PC\"])\n\nG.add_edge(\"router\", \"switch_1\")\nG.add_edge(\"router\", \"switch_2\")\nG.add_edge(\"router\", \"switch_3\")\nfor u in range(1, 4):\n    for v in range(1, 4):\n        G.add_edge(\"switch_\" + str(u), \"PC_\" + str(u) + \"_\" + str(v))\n\n# Get a reproducible layout and create figure\npos = nx.spring_layout(G, seed=1734289230)\nfig, ax = plt.subplots()\n\n# Note: the min_source/target_margin kwargs only work with FancyArrowPatch objects.\n# Force the use of FancyArrowPatch for edge drawing by setting `arrows=True`,\n# but suppress arrowheads with `arrowstyle=\"-\"`\nnx.draw_networkx_edges(\n    G,\n    pos=pos,\n    ax=ax,\n    arrows=True,\n    arrowstyle=\"-\",\n    min_source_margin=15,\n    min_target_margin=15,\n)\n\n# Transform from data coordinates (scaled between xlim and ylim) to display coordinates\ntr_figure = ax.transData.transform\n# Transform from display to figure coordinates\ntr_axes = fig.transFigure.inverted().transform\n\n# Select the size of the image (relative to the X axis)\nicon_size = (ax.get_xlim()[1] - ax.get_xlim()[0]) * 0.025\nicon_center = icon_size / 2.0\n\n# Add the respective image to each node\nfor n in G.nodes:\n    xf, yf = tr_figure(pos[n])\n    xa, ya = tr_axes((xf, yf))\n    # get overlapped axes and plot icon\n    a = plt.axes([xa - icon_center, ya - icon_center, icon_size, icon_size])\n    a.imshow(G.nodes[n][\"image\"])\n    a.axis(\"off\")\nplt.show()\n", "path": "examples/drawing/plot_custom_node_icons.py"}]}