Fun*_*ngl -1 python numpy matplotlib comma python-3.x
我想在yticklabel小数点分隔符上从小数点更改为逗号,但是在使用此代码或该代码中的代码后,请保留偏移文本的格式(1e-14)。

我的问题:
e为E?我正在使用Python 3.5
要将小数点分隔符从点更改为逗号,可以将更locale改为使用逗号的位置。例如,在这里我将其设置为德语:
#Locale settings
import locale
# Set to German locale to get comma decimal separater
locale.setlocale(locale.LC_NUMERIC, "de_DE")
import numpy as np
import matplotlib.pyplot as plt
plt.rcdefaults()
# Tell matplotlib to use the locale we set above
plt.rcParams['axes.formatter.use_locale'] = True
# make the figure and axes
fig,ax = plt.subplots(1)
# Some example data
x=np.arange(100)
y=4e-18*x**2
# plot the data
ax.plot(x,y,'b-')
plt.show()
Run Code Online (Sandbox Code Playgroud)
将指数更改为E偏移文本似乎不是一件容易的事。您可以从这里的答案开始。
| 归档时间: |
|
| 查看次数: |
2620 次 |
| 最近记录: |