1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
| def xiangxiantu_one_por(file_path: str, img_name: str, key_point_value: float ): df = pd.read_csv(file_path, header=None, names=['img_name', 'por', 'K'])
df['por'] = pd.to_numeric(df['por'], errors='coerce') df['por'] = df['por'] * 100 por = df['por'].dropna()
fig, ax = plt.subplots(figsize=(3, 2.7), dpi=300)
plt.rcParams['font.family'] = 'serif' plt.rcParams['font.serif'] = ['Times New Roman'] + plt.rcParams['font.serif']
data = [por] labels = [img_name] boxplot = ax.boxplot(data, notch=True, patch_artist=True, tick_labels=labels)
ax.set_ylim(10, 30)
colors = ['lightgreen'] for box, color in zip(boxplot['boxes'], colors): box.set(facecolor=color)
ax.scatter(1, key_point_value, color='red', s=50, zorder=5, marker='o')
ax.grid(True, which='both', linestyle='-', linewidth=0.5, alpha=0.5)
ax.yaxis.set_major_locator(ticker.MultipleLocator(5))
ax.tick_params(axis='x', labelsize=7) ax.tick_params(axis='y', labelsize=8)
ax.tick_params(axis='x', which='major', length=4, width=1, direction='in') ax.tick_params(axis='x', which='minor', length=3, width=1, direction='in') ax.tick_params(axis='y', which='major', length=4, width=1, direction='in') ax.tick_params(axis='y', which='minor', length=3, width=1, direction='in')
ax.spines['bottom'].set_linewidth(1) ax.spines['left'].set_linewidth(1) ax.spines['top'].set_linewidth(1) ax.spines['right'].set_linewidth(1)
ax.set_ylabel('POR(%)', fontsize=10, fontname='Times New Roman', fontweight='bold')
plt.tight_layout() return plt
def xiangxiantu_one_K(file_path: str, img_name: str, key_point_value: float ): df = pd.read_csv(file_path, header=None, names=['img_name', 'por', 'K']) df['K'] = pd.to_numeric(df['K'], errors='coerce') K = df['K'].dropna()
fig, ax = plt.subplots(figsize=(3, 2.7), dpi=300)
plt.rcParams['font.family'] = 'serif' plt.rcParams['font.serif'] = ['Times New Roman'] + plt.rcParams['font.serif']
data = [K] labels = [img_name] boxplot = ax.boxplot(data, notch=True, patch_artist=True, tick_labels=labels)
colors = ['lightgreen'] for box, color in zip(boxplot['boxes'], colors): box.set(facecolor=color)
ax.scatter(1, key_point_value, color='red', s=50, zorder=5, marker='o')
ax.grid(True, which='both', linestyle='-', linewidth=0.5, alpha=0.5)
ax.set_yscale('log') formatter = ScalarFormatter(useOffset=False, useMathText=False) ax.yaxis.set_major_formatter(formatter) ax.set_ylim(1, 1000)
ax.tick_params(axis='x', labelsize=7) ax.tick_params(axis='y', labelsize=8)
ax.tick_params(axis='x', which='major', length=4, width=1, direction='in') ax.tick_params(axis='x', which='minor', length=3, width=1, direction='in') ax.tick_params(axis='y', which='major', length=4, width=1, direction='in') ax.tick_params(axis='y', which='minor', length=3, width=1, direction='in')
ax.spines['bottom'].set_linewidth(1) ax.spines['left'].set_linewidth(1) ax.spines['top'].set_linewidth(1) ax.spines['right'].set_linewidth(1)
ax.set_ylabel('Permeability(mD)', fontsize=10, fontname='Times New Roman', fontweight='bold')
plt.tight_layout() return plt
|