简体   繁体   English

matplotlib轴标签中可以有两种不同的字体大小吗?

[英]Can I have two different font sizes in a matplotlib axes label?

Is is possible to have two different font sizes in one matplotlib axes label? 一个matplotlib轴标签中可以有两种不同的字体大小吗? I know I can set the font size with 我知道我可以用

fontsize = int

but what I would like to do is something like: 但是我想做的是:

plt.ylabel('Text 1', fontsize1=20, 'Text 2', fontsize2=15)

is there a way in matplotlib / seaborn to do so? matplotlib / seaborn中有没有办法做到这一点?

Thanks 谢谢

One thing you can do is using LaTeX in order to get different sizes in the same string: 您可以做的一件事是使用LaTeX,以便在同一字符串中获得不同的大小:

plt.rc('text', usetex=True)
plt.ylabel(r'\small{Text 1} \Huge{Text2}')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM