i have issue plotting info boxes of data , fit. toy example follows. import numpy np import matplotlib.pyplot plt #works sigma = 0.12 mu = 0.5 #half works sigma = 0.1 mu = 0.3 ##none works #sigma = 0.05 #mu = 0.2 sample = np.random.normal(mu, sigma, 10000) fighs = plt.figure() axhs = fighs.add_subplot(1, 1, 1) n, histbins, patches = axhs.hist(sample,100, histtype='step', normed=1) axhs.annotate("$\mu=%.3f$ \n $\sigma=%.3f$ \n $n=%i$"% (sample.mean(), sample.std(), len(sample)), xytext=(0.8, 0.85), bbox=dict(boxstyle="sawtooth", fc="w"), xy=(0.8, 0.85), textcoords='axes fraction') axhs.plot(histbins, plt.mlab.normpdf(histbins, mu, sigma)) axhs.annotate(" $\mu=%.3f$ \n $\sigma=%.3f$ \n $n=%s$"%(mu,sigma,"--"), xytext=(0.6, 0.85), bbox=dict(boxstyle="round", fc="w"), xy=(0.6, 0.85), textcoords='axes fraction') plt....
Comments
Post a Comment