[英]How to plot the string with power of ten as the exponential?
you can do that by extracting the base and exp:您可以通过提取基数和 exp 来做到这一点:
import matplotlib.pyplot as plt
from math import log10, floor
def find_exp_base(number):
exp = floor(log10(abs(number)))
return round(number/10**exp, 2), exp
data = 5.55e10
base, exp = find_exp_base(data)
plt.title('e$^{' + str(base) + '*10^{'+ str(exp) + '}}$')
plt.show()
output :输出 :
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.