这是我的代码。我似乎还没有得到代码的输出。我也没有收到错误。
如何显示我的情节?
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
data = pd.read_csv('by7.txt', delim_whitespace=True, index_col='M__DEPTH')
data = data.replace('-999.00000', np.nan)
data = data.rename(columns=({'M__Depth': 'DEPT'}))
data['DEPT'] = data.index
def triple_combo_plot(top_depth, bottom_depth):
logs = data[(data.DEPT >= top_depth) & (data.DEPT <= bottom_depth)]
fig, ax = plt.subplots(nrows=1, ncols=3, figsize=(12, 10), sharey=True)
fig.suptitle("Well Composite", fontsize=22)
fig.subplots_adjust(top=0.75, wspace=0.1)
# General setting for all axis
for axes in ax:
axes.set_ylim(top_depth, bottom_depth)
axes.invert_yaxis()
axes.yaxis.grid(True)
axes.get_xaxis().set_visible(False)
for (i, j) in zip(tops_depths):
if ((i >= top_depth) and (i <= bottom_depth)):
axes.axhline(y=i, linewidth=0.5, color='black')
axes.text(0.1, i, j, horizontalalignment='center', verticalalignment='center')
# sp track
ax01 = ax[0].twiny()
ax01.set_xlim(-50, 0)
ax01.spines['top'].set_position(('outward', 0))
ax01.set_xlabel("SP [mV]")
ax01.plot(logs.SP, logs.DEPT, label='SP[mV]', color='blue')
ax01.set_xlabel('SP[mV]', color='blue')
ax01.tick_params(axis='x', colors='blue')
ax01.grid(True)
# RILD track
ax11 = ax[1].twiny()
ax11.set_xscale('log')
ax11.grid(True)
ax11.spines['top'].set_position(('outward', 80))
ax11.set_xlabel('RILD[m.ohm]', color='red')
ax11.plot(logs.RILD, logs.DEPT, label='ILD[m.ohm]', color='red')
ax11.tick_params(axis='x', colors='red')
# RSD track
ax21 = ax[2].twiny()
ax21.set_xlim(0.1, 100)
ax21.set_xscale('log')
ax21.plot(logs.RSD, logs.DEPT, '--', label='RSD[m.ohm]', color='black')
ax21.spines['top'].set_position(('outward', 0))
ax21.set_xlabel('RSD[m.ohm]', color='black')
ax21.tick_params(axis='x', colors='black')