我想创建一个轴标题,其中有一部分是粗体字体.
这是我当前代码的一个示例:
# Features to plot
features = ['Overall Rating', 'Shooting Rating', 'Creativity Rating', 'Passing Rating',
'Dribbling Rating', 'Defending Rating', 'Pressing Rating', 'Aerial Rating']
# Loop through each feature and create density plots
for i, feature in enumerate(features):
ax = axes[i]
# Draw the density plot using the current feature column from the DataFrame
sns.kdeplot(df[feature], shade=True, color='white', ax=ax)
# Plot marker for df
player_value = df[feature].values[0]
ax.set_title(f'{feature}\n{int(player_value)}', color='#100097', loc='right', fontweight ="bold")
我希望feature
的文本为正常字体粗细,player_value
为粗体粗细.
我try 了各种方法,但都无济于事:为每段文本创建单独的标题,try 在set_title
函数中分别设置字体宽度,等等.