289 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			Python
		
	
	
	
			
		
		
	
	
			289 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			Python
		
	
	
	
| #!/usr/bin/env python3
 | |
| """
 | |
| 东亚生殖崇拜文化传播可视化工具
 | |
| East Asian Phallic Worship Cultural Transmission Visualization
 | |
| """
 | |
| 
 | |
| import matplotlib.pyplot as plt
 | |
| import matplotlib.patches as patches
 | |
| from datetime import datetime
 | |
| import numpy as np
 | |
| 
 | |
| # 设置中文字体
 | |
| plt.rcParams['font.sans-serif'] = ['SimHei', 'DejaVu Sans']
 | |
| plt.rcParams['axes.unicode_minus'] = False
 | |
| 
 | |
| def create_timeline_visualization():
 | |
|     """创建文化传播时间线可视化"""
 | |
|     
 | |
|     fig, ax = plt.subplots(figsize=(16, 10))
 | |
|     
 | |
|     # 时间线数据
 | |
|     events = [
 | |
|         {"year": 386, "event": "北魏建立", "culture": "鲜卑生殖崇拜文化确立", "color": "#FF6B6B"},
 | |
|         {"year": 494, "event": "孝文帝汉化改革", "culture": "鲜卑文化与汉文化融合", "color": "#4ECDC4"},
 | |
|         {"year": 538, "event": "佛教传入日本", "culture": "携带北魏生殖崇拜理念", "color": "#45B7D1"},
 | |
|         {"year": 593, "event": "圣德太子摄政", "culture": "全面接受大陆文化", "color": "#96CEB4"},
 | |
|         {"year": 645, "event": "大化改新", "culture": "制度化移植北魏模式", "color": "#FFEAA7"},
 | |
|         {"year": 710, "event": "奈良时代", "culture": "日本阳具崇拜文化成型", "color": "#DDA0DD"}
 | |
|     ]
 | |
|     
 | |
|     # 绘制时间轴
 | |
|     years = [event["year"] for event in events]
 | |
|     y_pos = 0
 | |
|     
 | |
|     # 主时间线
 | |
|     ax.plot([min(years)-20, max(years)+20], [y_pos, y_pos], 'k-', linewidth=3, alpha=0.7)
 | |
|     
 | |
|     # 绘制事件点和标签
 | |
|     for i, event in enumerate(events):
 | |
|         # 事件点
 | |
|         ax.scatter(event["year"], y_pos, s=200, c=event["color"], 
 | |
|                   edgecolors='black', linewidth=2, zorder=5)
 | |
|         
 | |
|         # 事件标签(交替上下排列)
 | |
|         y_offset = 0.3 if i % 2 == 0 else -0.3
 | |
|         text_y = y_pos + y_offset
 | |
|         
 | |
|         # 连接线
 | |
|         ax.plot([event["year"], event["year"]], [y_pos, text_y], 
 | |
|                'k--', alpha=0.5, linewidth=1)
 | |
|         
 | |
|         # 事件文本
 | |
|         ax.text(event["year"], text_y + (0.1 if y_offset > 0 else -0.1), 
 | |
|                f'{event["year"]}年\n{event["event"]}\n{event["culture"]}',
 | |
|                ha='center', va='bottom' if y_offset > 0 else 'top',
 | |
|                bbox=dict(boxstyle="round,pad=0.3", facecolor=event["color"], alpha=0.7),
 | |
|                fontsize=10, fontweight='bold')
 | |
|     
 | |
|     # 设置图表属性
 | |
|     ax.set_xlim(350, 750)
 | |
|     ax.set_ylim(-1, 1)
 | |
|     ax.set_xlabel('年代 (CE)', fontsize=14, fontweight='bold')
 | |
|     ax.set_title('东亚生殖崇拜文化传播时间线\n从拓跋鲜卑到日本阳具崇拜', 
 | |
|                 fontsize=18, fontweight='bold', pad=20)
 | |
|     
 | |
|     # 隐藏y轴
 | |
|     ax.set_yticks([])
 | |
|     ax.spines['left'].set_visible(False)
 | |
|     ax.spines['right'].set_visible(False)
 | |
|     ax.spines['top'].set_visible(False)
 | |
|     
 | |
|     # 添加说明文字
 | |
|     explanation = """
 | |
|     关键发现:
 | |
|     • "祖"字 = 示(神灵)+ 且(阳具) = 祖先崇拜实为生殖崇拜
 | |
|     • 拓跋鲜卑通过政治文化体系将生殖崇拜传播到东亚
 | |
|     • 日本阳具崇拜文化直接源于北魏时期的文化传播
 | |
|     """
 | |
|     
 | |
|     ax.text(0.02, 0.98, explanation, transform=ax.transAxes, 
 | |
|            fontsize=12, verticalalignment='top',
 | |
|            bbox=dict(boxstyle="round,pad=0.5", facecolor='lightblue', alpha=0.8))
 | |
|     
 | |
|     plt.tight_layout()
 | |
|     return fig
 | |
| 
 | |
| def create_cultural_flow_diagram():
 | |
|     """创建文化流向图"""
 | |
|     
 | |
|     fig, ax = plt.subplots(figsize=(14, 10))
 | |
|     
 | |
|     # 文化传播节点
 | |
|     nodes = {
 | |
|         "鲜卑": {"pos": (2, 8), "color": "#FF6B6B", "size": 1000},
 | |
|         "北魏": {"pos": (4, 8), "color": "#4ECDC4", "size": 1200},
 | |
|         "汉文化": {"pos": (6, 6), "color": "#45B7D1", "size": 1000},
 | |
|         "佛教": {"pos": (8, 8), "color": "#96CEB4", "size": 800},
 | |
|         "日本": {"pos": (10, 6), "color": "#FFEAA7", "size": 1200},
 | |
|         "神道教": {"pos": (12, 4), "color": "#DDA0DD", "size": 800}
 | |
|     }
 | |
|     
 | |
|     # 文化传播箭头
 | |
|     arrows = [
 | |
|         ("鲜卑", "北魏", "生殖崇拜政治化"),
 | |
|         ("北魏", "汉文化", "文化融合"),
 | |
|         ("北魏", "佛教", "宗教改造"),
 | |
|         ("汉文化", "日本", "制度移植"),
 | |
|         ("佛教", "日本", "宗教传播"),
 | |
|         ("日本", "神道教", "本土化")
 | |
|     ]
 | |
|     
 | |
|     # 绘制节点
 | |
|     for name, info in nodes.items():
 | |
|         ax.scatter(info["pos"][0], info["pos"][1], s=info["size"], 
 | |
|                   c=info["color"], edgecolors='black', linewidth=2, alpha=0.8)
 | |
|         ax.text(info["pos"][0], info["pos"][1], name, ha='center', va='center',
 | |
|                fontsize=12, fontweight='bold', color='white')
 | |
|     
 | |
|     # 绘制箭头
 | |
|     for start, end, label in arrows:
 | |
|         start_pos = nodes[start]["pos"]
 | |
|         end_pos = nodes[end]["pos"]
 | |
|         
 | |
|         # 计算箭头位置
 | |
|         dx = end_pos[0] - start_pos[0]
 | |
|         dy = end_pos[1] - start_pos[1]
 | |
|         
 | |
|         # 绘制箭头
 | |
|         ax.annotate('', xy=end_pos, xytext=start_pos,
 | |
|                    arrowprops=dict(arrowstyle='->', lw=2, color='darkblue'))
 | |
|         
 | |
|         # 添加标签
 | |
|         mid_x = (start_pos[0] + end_pos[0]) / 2
 | |
|         mid_y = (start_pos[1] + end_pos[1]) / 2
 | |
|         ax.text(mid_x, mid_y + 0.2, label, ha='center', va='bottom',
 | |
|                fontsize=10, bbox=dict(boxstyle="round,pad=0.2", 
 | |
|                facecolor='white', alpha=0.8))
 | |
|     
 | |
|     # 添加"祖"字分析框
 | |
|     zu_analysis = """
 | |
|     "祖"字文化密码:
 | |
|     祖 = 示 + 且
 | |
|     示:神灵、祭祀
 | |
|     且:男性生殖器象形
 | |
|     
 | |
|     核心发现:
 | |
|     祖先崇拜 = 生殖崇拜
 | |
|     """
 | |
|     
 | |
|     ax.text(1, 2, zu_analysis, fontsize=11, 
 | |
|            bbox=dict(boxstyle="round,pad=0.5", facecolor='lightyellow', alpha=0.9),
 | |
|            verticalalignment='top')
 | |
|     
 | |
|     # 添加日本现象框
 | |
|     japan_phenomena = """
 | |
|     日本阳具崇拜现象:
 | |
|     • 金山神社
 | |
|     • 春祭仪式
 | |
|     • 相扑文化
 | |
|     • AV产业
 | |
|     • 少子化焦虑
 | |
|     """
 | |
|     
 | |
|     ax.text(11, 2, japan_phenomena, fontsize=11,
 | |
|            bbox=dict(boxstyle="round,pad=0.5", facecolor='lightpink', alpha=0.9),
 | |
|            verticalalignment='top')
 | |
|     
 | |
|     ax.set_xlim(0, 14)
 | |
|     ax.set_ylim(0, 10)
 | |
|     ax.set_title('东亚生殖崇拜文化传播流向图\n"祖"字密码的历史传承', 
 | |
|                 fontsize=16, fontweight='bold', pad=20)
 | |
|     ax.axis('off')
 | |
|     
 | |
|     plt.tight_layout()
 | |
|     return fig
 | |
| 
 | |
| def create_character_evolution_chart():
 | |
|     """创建"祖"字演变图表"""
 | |
|     
 | |
|     fig, ax = plt.subplots(figsize=(12, 8))
 | |
|     
 | |
|     # 字形演变数据
 | |
|     evolution_stages = [
 | |
|         {"stage": "甲骨文", "form": "且", "meaning": "男性生殖器象形", "period": "商代"},
 | |
|         {"stage": "金文", "form": "示且", "meaning": "神灵+生殖器", "period": "周代"},
 | |
|         {"stage": "小篆", "form": "祖", "meaning": "祖先崇拜确立", "period": "秦代"},
 | |
|         {"stage": "楷书", "form": "祖", "meaning": "生殖崇拜隐化", "period": "汉代以后"}
 | |
|     ]
 | |
|     
 | |
|     # 绘制演变过程
 | |
|     x_positions = np.linspace(1, 10, len(evolution_stages))
 | |
|     
 | |
|     for i, stage in enumerate(evolution_stages):
 | |
|         x = x_positions[i]
 | |
|         
 | |
|         # 绘制字形框
 | |
|         rect = patches.Rectangle((x-0.8, 4), 1.6, 2, 
 | |
|                                linewidth=2, edgecolor='black', 
 | |
|                                facecolor='lightblue', alpha=0.7)
 | |
|         ax.add_patch(rect)
 | |
|         
 | |
|         # 字形
 | |
|         ax.text(x, 5, stage["form"], ha='center', va='center',
 | |
|                fontsize=24, fontweight='bold')
 | |
|         
 | |
|         # 阶段名称
 | |
|         ax.text(x, 6.5, stage["stage"], ha='center', va='center',
 | |
|                fontsize=12, fontweight='bold')
 | |
|         
 | |
|         # 时期
 | |
|         ax.text(x, 3.5, stage["period"], ha='center', va='center',
 | |
|                fontsize=10, style='italic')
 | |
|         
 | |
|         # 含义
 | |
|         ax.text(x, 2.5, stage["meaning"], ha='center', va='center',
 | |
|                fontsize=10, wrap=True)
 | |
|         
 | |
|         # 连接箭头
 | |
|         if i < len(evolution_stages) - 1:
 | |
|             next_x = x_positions[i+1]
 | |
|             ax.annotate('', xy=(next_x-0.8, 5), xytext=(x+0.8, 5),
 | |
|                        arrowprops=dict(arrowstyle='->', lw=2, color='red'))
 | |
|     
 | |
|     # 添加核心发现
 | |
|     discovery_text = """
 | |
|     重大发现:
 | |
|     "祖"字从甲骨文到现代汉字的演变过程中,
 | |
|     始终保持着生殖崇拜的文化内核。
 | |
|     
 | |
|     这证明了:
 | |
|     1. 祖先崇拜本质上是生殖崇拜
 | |
|     2. 这种文化基因通过汉字传播到整个东亚
 | |
|     3. 日本的阳具崇拜文化有着深厚的历史根源
 | |
|     """
 | |
|     
 | |
|     ax.text(5.5, 0.5, discovery_text, ha='center', va='bottom',
 | |
|            fontsize=12, bbox=dict(boxstyle="round,pad=0.5", 
 | |
|            facecolor='lightyellow', alpha=0.9))
 | |
|     
 | |
|     ax.set_xlim(0, 11)
 | |
|     ax.set_ylim(0, 7)
 | |
|     ax.set_title('"祖"字演变与生殖崇拜文化传承', 
 | |
|                 fontsize=16, fontweight='bold', pad=20)
 | |
|     ax.axis('off')
 | |
|     
 | |
|     plt.tight_layout()
 | |
|     return fig
 | |
| 
 | |
| def generate_all_visualizations():
 | |
|     """生成所有可视化图表"""
 | |
|     
 | |
|     print("🎨 生成东亚生殖崇拜文化传播可视化图表...")
 | |
|     
 | |
|     # 创建输出目录
 | |
|     import os
 | |
|     output_dir = "output/cultural_transmission_viz"
 | |
|     os.makedirs(output_dir, exist_ok=True)
 | |
|     
 | |
|     # 生成时间线图
 | |
|     print("📅 生成文化传播时间线...")
 | |
|     fig1 = create_timeline_visualization()
 | |
|     fig1.savefig(f"{output_dir}/cultural_transmission_timeline.png", 
 | |
|                 dpi=300, bbox_inches='tight')
 | |
|     plt.close(fig1)
 | |
|     
 | |
|     # 生成流向图
 | |
|     print("🌊 生成文化流向图...")
 | |
|     fig2 = create_cultural_flow_diagram()
 | |
|     fig2.savefig(f"{output_dir}/cultural_flow_diagram.png", 
 | |
|                 dpi=300, bbox_inches='tight')
 | |
|     plt.close(fig2)
 | |
|     
 | |
|     # 生成字形演变图
 | |
|     print("📝 生成'祖'字演变图...")
 | |
|     fig3 = create_character_evolution_chart()
 | |
|     fig3.savefig(f"{output_dir}/zu_character_evolution.png", 
 | |
|                 dpi=300, bbox_inches='tight')
 | |
|     plt.close(fig3)
 | |
|     
 | |
|     print(f"✅ 所有图表已保存到 {output_dir}/ 目录")
 | |
|     print("\n🎯 可视化图表说明:")
 | |
|     print("1. cultural_transmission_timeline.png - 文化传播时间线")
 | |
|     print("2. cultural_flow_diagram.png - 文化流向关系图")
 | |
|     print("3. zu_character_evolution.png - '祖'字演变分析图")
 | |
|     
 | |
|     return output_dir
 | |
| 
 | |
| if __name__ == "__main__":
 | |
|     generate_all_visualizations() |