<jupyter_start><jupyter_text>get_edge_colors_by_attrGet colors based on edge attribute values.<jupyter_code># Software for Complex Networks. NetworkX has 12 repositories available. Follow their code on GitHub.
import networkx as nx

# OSMnx: New Methods for Acquiring, Constructing, Analyzing, and Visualizing Complex Street Networks
import osmnx as ox

ox.config(use_cache=True, log_console=False)
ox.__version__
query = '중구, 서울특별시, 대한민국'
network_type = 'drive' # "all_private", "all", "bike", "drive", "drive_service", "walk"

# Create graph from OSM within the boundaries of some geocodable place(s).
G = ox.graph_from_place(query, network_type=network_type)

# Plot a graph.
fig, ax = ox.plot_graph(G)
# Choosing Colormaps in Matplotlib
# https://matplotlib.org/stable/tutorials/colors/colormaps.html

# convert graph to line graph so edges become nodes and vice versa
edge_centrality = nx.closeness_centrality(nx.line_graph(G))
nx.set_edge_attributes(G, edge_centrality, "edge_centrality")

# color edges in original graph with closeness centralities from line graph
edge_color = ox.plot.get_edge_colors_by_attr(
    G, 
    "edge_centrality", 
    cmap="viridis", # name of a matplotlib colormap
    start=0, 
    stop=1, 
    na_color='none', 
    equal_size=False
)

# Plot a graph.
fig, ax = ox.plot_graph(G, edge_color=edge_color, edge_linewidth=2, node_size=0)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09493219129193434, 'fraction_numerical': 0.004282655246252677, 'mean_word_length': 5.52093023255814, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '449689', 'license': 'MIT', 'n_tokens_mistral': 499, 'n_tokens_neox': 495, 'n_words': 132, 'path': 'osmnx/plot/get_edge_colors_by_attr.ipynb', 'repo_name': 'w3labkr/ipynb-gis', 'size': '1401'}