MAE_ATMO/未命名1.ipynb

42 KiB

In [1]:
import pandas as pd
In [9]:
rst_mix = pd.read_csv('./mix_eva.csv')
rst_mix.index = [10, 20, 30, 40]
In [10]:
import matplotlib.pyplot as plt
In [36]:
colors = [(211, 65, 51), (240, 155, 39), (25, 152, 128)]
rgb_colors = [tuple(c/255 for c in color) for color in colors]
In [11]:
# 设置字体为Times new Roman
plt.rcParams['font.sans-serif'] = ['Times New Roman']
In [43]:
plt.figure(figsize=(16, 9))
rst_mix.plot.bar(color=rgb_colors, width=0.75)
plt.xlabel('Missing Rate(%)', fontsize=14)
plt.ylabel('Sample Counts', fontsize=14)
plt.xticks(rotation=-45, fontsize=14)
plt.yticks(fontsize=14)
plt.tight_layout()
plt.legend(loc='best', fontsize=16)
plt.savefig('./miss_counts.png')
<Figure size 1600x900 with 0 Axes>
No description has been provided for this image
In [21]:
import matplotlib as mpl
In [7]:
mpl.get_cachedir()
Out[7]:
'/root/.cache/matplotlib'
In [ ]:
 
In [44]:
draw_data = pd.read_csv('./data_count.csv')
In [45]:
draw_data
Out[45]:
month count mean std min 25% 50% 75% max
0 2022-01 31.0 0.375894 0.278728 0.024402 0.153636 0.311435 0.541388 1.000000
1 2022-02 27.0 0.223323 0.247666 0.000000 0.031531 0.110574 0.359928 0.904019
2 2022-03 31.0 0.346938 0.326758 0.000000 0.055048 0.280622 0.582225 1.000000
3 2022-04 30.0 0.241667 0.255629 0.000526 0.031316 0.118349 0.402727 0.823110
4 2022-05 31.0 0.261153 0.291343 0.000000 0.042153 0.099043 0.377679 0.899809
5 2022-06 30.0 0.307410 0.249777 0.025933 0.097787 0.216268 0.538828 0.885215
6 2022-07 31.0 0.471889 0.258072 0.004402 0.286459 0.502584 0.638947 0.914545
7 2022-08 31.0 0.411485 0.286403 0.009043 0.194211 0.354785 0.603086 0.945215
8 2022-09 30.0 0.240635 0.250689 0.000048 0.039462 0.136196 0.377416 0.910239
9 2022-10 31.0 0.334396 0.274684 0.000000 0.116818 0.291053 0.494833 0.883923
10 2022-11 29.0 0.405854 0.308861 0.016603 0.107081 0.476172 0.629474 0.941579
11 2022-12 31.0 0.223386 0.194496 0.006938 0.060502 0.182727 0.271172 0.680622
In [ ]:
fig, ax = plt.subplots(figsize=(16, 9))
# plt.plot(range(1, 13), des['mean'].values, '*-')
bp = ax.boxplot(draw_data, showmeans=True, patch_artist=False, widths=0.5, boxprops=dict(linewidth=2),
                medianprops=dict(color='red', linewidth=2),
                meanprops=dict(marker='*', markersize=8, linewidth=2),
                # whiskerprops=dict(color='black', linewidth=1.5),
                # capprops=dict(color='black', linewidth=1.5)
                )
# 创建一个仅包含标记的图例项
circle = mlines.Line2D([], [], color='green', marker='*', linestyle='None', markersize=8, label='Mean Point')
median_line = mlines.Line2D([], [], color='red', marker='', linestyle='-', linewidth=2, label='Median Line')
ax.set_xlabel('Month', fontsize=16)
ax.set_ylabel('Missing Rate', fontsize=16)
ax.set_xticklabels(months, fontsize=16)
# 获取当前的y轴标签
yticklabels = ax.get_yticklabels()

# 设置y轴标签的字体大小
for label in yticklabels:
    label.set_fontsize(16)
# 添加图例
ax.legend(handles=[median_line, circle], fontsize=16)
plt.show()