Untitled
unknown
plain_text
a year ago
2.8 kB
7
Indexable
import matplotlib.pyplot as plt import networkx as nx # Initialize the directed graph G = nx.DiGraph() # Add nodes and edges for Microevolution G.add_node("Microevolution", color='skyblue', size=3000) G.add_node("Mutation", color='lightgreen', size=2000) G.add_node("Natural Selection", color='lightgreen', size=2000) G.add_node("Genetic Drift", color='lightgreen', size=2000) G.add_node("Gene Flow", color='lightgreen', size=2000) G.add_node("Small-scale Changes", color='lightcoral', size=2500) G.add_node("Observable in Short Time", color='lightcoral', size=2500) G.add_node("Examples: Antibiotic Resistance, Finch Beaks", color='lightcoral', size=2500) G.add_edges_from([ ("Microevolution", "Mutation"), ("Microevolution", "Natural Selection"), ("Microevolution", "Genetic Drift"), ("Microevolution", "Gene Flow"), ("Microevolution", "Small-scale Changes"), ("Microevolution", "Observable in Short Time"), ("Microevolution", "Examples: Antibiotic Resistance, Finch Beaks") ]) # Add nodes and edges for Macroevolution G.add_node("Macroevolution", color='skyblue', size=3000) G.add_node("Speciation", color='lightgreen', size=2000) G.add_node("Adaptive Radiation", color='lightgreen', size=2000) G.add_node("Mass Extinctions", color='lightgreen', size=2000) G.add_node("Large-scale Changes", color='lightcoral', size=2500) G.add_node("Observable in Long Time", color='lightcoral', size=2500) G.add_node("Examples: Mammalian Evolution, Plant Diversification", color='lightcoral', size=2500) G.add_edges_from([ ("Macroevolution", "Speciation"), ("Macroevolution", "Adaptive Radiation"), ("Macroevolution", "Mass Extinctions"), ("Macroevolution", "Large-scale Changes"), ("Macroevolution", "Observable in Long Time"), ("Macroevolution", "Examples: Mammalian Evolution, Plant Diversification") ]) # Add commonalities G.add_node("Common Mechanisms", color='lavender', size=3000) G.add_node("Mutation, Natural Selection, Genetic Drift, Gene Flow", color='lavender', size=2500) G.add_node("Evidence: Fossils, Genetics, Anatomy, Biogeography", color='lavender', size=2500) G.add_edges_from([ ("Common Mechanisms", "Mutation, Natural Selection, Genetic Drift, Gene Flow"), ("Common Mechanisms", "Evidence: Fossils, Genetics, Anatomy, Biogeography"), ("Microevolution", "Common Mechanisms"), ("Macroevolution", "Common Mechanisms") ]) # Define node attributes colors = nx.get_node_attributes(G, 'color').values() sizes = [G.nodes[node]['size'] for node in G.nodes] # Plot the concept map plt.figure(figsize=(14, 10)) pos = nx.spring_layout(G, seed=42) # for better layout nx.draw(G, pos, with_labels=True, node_color=colors, node_size=sizes, font_size=10, font_weight='bold', edge_color='gray') plt.title("Concept Map of Microevolution vs. Macroevolution", size=20) plt.show()
Editor is loading...
Leave a Comment