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
| def sandian1(file_path: str, red_point_por: float, red_point_K: float, red_point_name: str, ): 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 df['K'] = pd.to_numeric(df['K'], errors='coerce') por = df['por'] K = df['K'] por2 = red_point_por K2 = red_point_K name2 = red_point_name
fig, ax = plt.subplots(figsize=(3.9, 2.7), dpi=300)
plt.rcParams['font.family'] = 'serif' plt.rcParams['font.serif'] = ['Times New Roman'] + plt.rcParams['font.serif']
ax.scatter(por, K, marker='s', color='black', facecolors='none', s=50, label=img_name) ax.scatter(por2, K2, marker='o', color='red', s=80, label=name2)
ax.set_yscale('log') formatter = ScalarFormatter(useOffset=False, useMathText=False) ax.yaxis.set_major_formatter(formatter) ax.set_xlim(10, 30) ax.set_ylim(1, 1000) ax.xaxis.set_major_locator(ticker.MultipleLocator(5))
ax.tick_params(axis='x', labelsize=10) ax.tick_params(axis='y', labelsize=10) x_labels = ax.get_xticklabels() y_labels = ax.get_yticklabels() for label in x_labels: label.set_fontname('Times New Roman') label.set_fontweight('bold') for label in y_labels: label.set_fontname('Times New Roman') label.set_fontweight('bold')
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_xlabel('POR(%)', fontsize=11, fontname='Times New Roman', fontweight='bold') ax.set_ylabel('Permeability(mD)', fontsize=11, fontname='Times New Roman', fontweight='bold')
legend = ax.legend(fontsize=8) legend.get_frame().set_linewidth(0.0) legend.get_frame().set_facecolor('none')
ax.grid(True, which='both', linestyle='-', linewidth=0.5, alpha=0.5)
plt.tight_layout()
return plt
|