无论我如何努力去掉这个标记,它都会在我的图表上存在。我尝试过关闭刻度、刻度标签、网格线和许多其他东西,但都没有成功。
包含图表创建的完整代码,如果我确切知道哪部分代码导致了这个问题,我会包含更简化的代码。
import matplotlib.pyplot as plt
plt.style.use('dark_background')
my_figure = plt.figure(**{'dpi': 100.0,
'edgecolor': 'black',
'facecolor': 'black',
'figsize': (8.0, 6.0),
'linewidth': 1.0})
my_figure.suptitle(**{'fontsize': 'x-large',
'fontweight': 'semibold',
'horizontalalignment': 'center',
't': 'Boxplot',
'verticalalignment': 'top'})
my_figure.supxlabel(**{'fontsize': 'large',
'fontweight': 'normal',
'horizontalalignment': 'center',
't': 'values',
'verticalalignment': 'bottom'})
my_figure.supylabel(**{'fontsize': 'large',
'fontweight': 'normal',
'horizontalalignment': 'center',
't': 'values',
'verticalalignment': 'bottom'})
axes_dictionary = my_figure.subplot_mosaic(mosaic=[['boxplot'], ['histogram'], ['histogram'], ['histogram']]
, gridspec_kw={'wspace': 0.0, 'hspace': 0.0})
axes_dictionary['boxplot'].bxp(**{'boxprops': {'alpha': 0.8, 'facecolor': 'C0'},
'bxpstats': [{'label': 'obs5',
'mean': 74.00224000000001,
'med': 74.004,
'q1': 73.996,
'q3': 74.009,
'whishi': 73.984,
'whislo': 74.014}],
'capprops': {'color': 'C0'},
'patch_artist': True,
'positions': [0],
'showfliers': False,
'vert': False,
'whiskerprops': {'color': 'C0'},
'widths': 0.5,
'zorder': 1.0})
axes_dictionary['histogram'].hist(**{'align': 'mid',
'alpha': 0.6,
'bins': [73.98100280761719,
73.98699951171875,
73.99299621582031,
73.9990005493164,
74.00499725341797,
74.01100158691406,
74.017],
'color': 'C0',
'histtype': 'bar',
'label': 'obs5',
'orientation': 'vertical',
'weights': [1, 3, 5, 6, 6, 4],
'x': [73.98100280761719,
73.98699951171875,
73.99299621582031,
73.9990005493164,
74.00499725341797,
74.01100158691406],
'zorder': 0.0})
axes_dictionary['histogram'].set_xticks(
ticks=[73.98100280761719, 73.98699951171875, 73.99299621582031, 73.9990005493164, 74.00499725341797,
74.01100158691406, 74.017])
axes_dictionary['histogram'].set_xticklabels(
labels=[73.98100280761719, 73.98699951171875, 73.99299621582031, 73.9990005493164, 74.00499725341797,
74.01100158691406, 74.017])
axes_dictionary['histogram'].set_yticks(ticks=axes_dictionary['histogram'].get_yticks())
axes_dictionary['histogram'].set_yticklabels(labels=['', '1', '2', '3', '4', '5', '6', '7'])
axes_dictionary['boxplot'].set_xlim(**{'left': 73.97920303344726, 'right': 74.01879806518555})
axes_dictionary['boxplot'].tick_params(**{'labelbottom': False,
'labelleft': False,
'labelright': False,
'labeltop': False})
axes_dictionary['boxplot'].spines['left'].set_visible(False)
axes_dictionary['boxplot'].spines['bottom'].set_visible(True)
axes_dictionary['boxplot'].spines['top'].set_visible(False)
axes_dictionary['boxplot'].spines['right'].set_visible(False)
axes_dictionary['boxplot'].tick_params(**{'axis': 'x',
'bottom': False,
'color': 'white',
'direction': 'inout',
'length': 3.0,
'pad': 7.0,
'top': False,
'which': 'major',
'width': 1.0,
'zorder': 1.0})
axes_dictionary['boxplot'].tick_params(**{'axis': 'x',
'bottom': False,
'color': 'white',
'direction': 'inout',
'length': 5.0,
'pad': 4.0,
'top': False,
'which': 'minor',
'width': 5.0,
'zorder': 1.0})
axes_dictionary['boxplot'].tick_params(**{'axis': 'y',
'color': 'white',
'direction': 'out',
'left': False,
'length': 3.0,
'pad': 7.0,
'right': False,
'which': 'major',
'width': 1.0,
'zorder': 1.0})
axes_dictionary['boxplot'].tick_params(**{'axis': 'y',
'color': 'white',
'direction': 'inout',
'left': False,
'length': 2.0,
'pad': 4.0,
'right': False,
'which': 'minor',
'width': 1.0,
'zorder': 1.0})
axes_dictionary['boxplot'].grid(**{'axis': 'x', 'visible': False, 'which': 'major'})
axes_dictionary['boxplot'].grid(**{'axis': 'x', 'visible': False, 'which': 'minor'})
axes_dictionary['boxplot'].grid(**{'axis': 'y', 'visible': False, 'which': 'major'})
axes_dictionary['boxplot'].tick_params(**{'axis': 'y', 'labelbottom': True, 'which': 'major'})
axes_dictionary['histogram'].spines['left'].set_visible(False)
axes_dictionary['histogram'].spines['bottom'].set_visible(True)
axes_dictionary['histogram'].spines['top'].set_visible(False)
axes_dictionary['histogram'].spines['right'].set_visible(False)
axes_dictionary['histogram'].legend('', frameon=False)
axes_dictionary['histogram'].tick_params(**{'axis': 'x',
'bottom': True,
'color': 'white',
'direction': 'inout',
'length': 3.0,
'pad': 7.0,
'top': False,
'which': 'major',
'width': 1.0,
'zorder': 1.0})
axes_dictionary['histogram'].tick_params(**{'axis': 'x',
'bottom': False,
'color': 'white',
'direction': 'inout',
'length': 5.0,
'pad': 4.0,
'top': False,
'which': 'minor',
'width': 5.0,
'zorder': 1.0})
axes_dictionary['histogram'].tick_params(**{'axis': 'y',
'color': 'white',
'direction': 'out',
'left': False,
'length': 3.0,
'pad': 7.0,
'right': False,
'which': 'major',
'width': 1.0,
'zorder': 1.0})
axes_dictionary['histogram'].tick_params(**{'axis': 'y',
'color': 'white',
'direction': 'inout',
'left': False,
'length': 2.0,
'pad': 4.0,
'right': False,
'which': 'minor',
'width': 1.0,
'zorder': 1.0})
axes_dictionary['histogram'].grid(**{'axis': 'x', 'visible': False, 'which': 'major'})
axes_dictionary['histogram'].grid(**{'axis': 'x', 'visible': False, 'which': 'minor'})
axes_dictionary['histogram'].grid(**{'axis': 'y', 'visible': False, 'which': 'major'})
axes_dictionary['histogram'].tick_params(**{'axis': 'x', 'labelbottom': True, 'which': 'major'})
axes_dictionary['histogram'].tick_params(**{'axis': 'y', 'labelbottom': True, 'which': 'major'})
plt.show()
我认为这只是箱线图轴底部脊柱的一部分显示出来。对我来说,只需更改一行即可消除它: