Matplotlib:更改指数的字体大小 [英] Matplotlib: changing font size of exponent

查看:65
本文介绍了Matplotlib:更改指数的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改图片上标记的指数的字体大小 我无法使用matplotlib.rc('font',** font)方法,因为我有不同的绘图,需要不同的字体大小,因此我分别更改了每个元素.但是我找不到指数的字体属性.

I want to change the fontsize of the exponent as marked on the picture I cannot use the matplotlib.rc('font', **font) method since I have different plots that need different font sizes so I change every element individually. I can however not find the font properties of the exponent.

推荐答案

如果指数是由matplotlib计算的offset,则可以执行以下操作将指数的字体大小更改为30

If the exponent is an offset computed by matplotlib you can do the following to change the font size of the exponent to 30

import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(1,1.0001,100)

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(x)
t = ax.yaxis.get_offset_text()
t.set_size(30)
plt.show()

这篇关于Matplotlib:更改指数的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆