2017-05-02 12 views

Antwort

1

Sie können eine matplotlib.ticker.StrMethodFormatter verwenden, um die Etiketten mit der Anzahl der erforderlichen signifikanten Ziffern zu formatieren. Um z.B. 6 signifikante Stellen, verwenden

matplotlib.ticker.StrMethodFormatter("{x:.6f}") 

Ein vollständiges Beispiel:

import numpy as np; np.random.seed(3) 
import matplotlib.pyplot as plt 
import matplotlib.ticker 

x = np.linspace(500,900, num=201) 
y = np.cumsum(np.random.normal(loc=0,scale=1e-4,size=len(x)))+1.0888 
fig, ax=plt.subplots() 
ax.plot(x,y) 
ax.yaxis.set_major_formatter(matplotlib.ticker.StrMethodFormatter("{x:.6f}")) 

plt.show() 

enter image description here

+0

Das war genau das, was ich suchte, Dank! – ger579

Verwandte Themen