多个字幕

Jul*_*res 5 python matplotlib

我有一个标题,但我还想添加两个副标题。该图已损坏或分为两个子图,因此需要两个字幕。

#Add sub-plot
subtitle_string_1=("An In-depth Comparison")
subtitle_string_2=("Immediately Following                                                                 
First Of The Month Following")

plt.suptitle(subtitle_string_1,fontsize=6,x=0.9, y=0.8)
plt.suptitle(subtitle_string_2,fontsize=6,x=.41, y=0.86, color='grey')
Run Code Online (Sandbox Code Playgroud)

是否有 sub_subtitle 选项?我真的很想有无限字幕,谈论力量!

小智 1

您可以使用字符串格式将第二个字符串添加到新行

plt.suptitle(f'(subtitle_string_1}\n{subtitle_string_2}', fontsize=6, x=0.9, y=0.8)
Run Code Online (Sandbox Code Playgroud)