我试图将子图(使用GridSpec创建)的x标签旋转45度。我尝试使用axa.set_xticks()和axa.set_xticklabels,但似乎无法正常工作。谷歌也没有提供帮助,因为大多数与标签有关的问题都是关于正常绘图而不是子图。
参见下面的代码:
width = 20 # Width of the figure in centimeters
height = 15 # Height of the figure in centimeters
w = width * 0.393701 # Conversion to inches
h = height * 0.393701 # Conversion to inches
f1 = plt.figure(figsize=[w,h])
gs = gridspec.GridSpec(1, 7, width_ratios = [1.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0])
axa = plt.subplot(gs[0])
axa.plot(dts, z,'k', alpha=0.75, lw=0.25)
#axa.set_title('...')
axa.set_ylabel('TVDSS ' + '$[m]$', fontsize = '10' )
axa.set_xlabel('slowness 'r'$[\mu s/m]$', fontsize …Run Code Online (Sandbox Code Playgroud)