import matplotlib.pyplot as plt
import numpy as np
from matplotlib.font_manager import FontProperties
# 血肿发生时间数据(去除0值)
blood_clot_times = [
9.5225, 26.4675, 40.056111111111115, 168.37305555555557, 14.870277777777778,
30.813055555555554, 39.50111111111111, 15.809166666666666, 29.176111111111112,
147.62194444444444, 12.860833333333334, 48.903888888888886, 16.225, 14.615833333333333,
23.726111111111113, 6.541666666666667, 9.653333333333332, 15.993611111111111,
14.119444444444444, 27.84722222222222, 20.573333333333334, 27.421666666666667,
11.924722222222222, 7.431666666666667, 42.75666666666667, 17.672777777777778
]
# 样本序号
sample_indices = np.arange(1, len(blood_clot_times) + 1)
# 中文字体设置
font = FontProperties(fname="C:/Windows/Fonts/simhei.ttf", size=12)
# 应用scienceplot风格并设置中文字体
with plt.style.context(['science', 'ieee', 'grid', 'no-latex']):
plt.rcParams['font.family'] = 'SimHei'
# 绘制散点图
plt.figure(figsize=(10, 6))
plt.scatter(sample_indices, blood_clot_times, c='b', marker='o', label='血肿发生时间')
plt.xlabel('样本序号')
plt.ylabel('血肿发生时间(h)')
plt.title('血肿发生时间分布散点图')
plt.legend()
plt.grid(True)
plt.show()
scienceplots显示中文(补充)
最新推荐文章于 2025-04-04 23:39:01 发布