計劃的註釋框沒有出現在我的情節,但是,我已經嘗試了其座標值範圍廣泛。註釋框不出現在matplotlib
這是什麼問題?
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt
def f(s,t):
a = 0.7
b = 0.8
Iext= 0.5
tau = 12.5
v = s[0]
w = s[1]
dndt = v - np.power(v,3)/3 - w + Iext
dwdt = (v + a - b * w)/tau
return [dndt, dwdt]
t = np.linspace(0,200)
s0=[1,1]
s = odeint(f,s0,t)
plt.plot(t,s[:,0],'b-', linewidth=1.0)
plt.xlabel(r"$t(sec.)$")
plt.ylabel(r"$V (volt)$")
plt.legend([r"$V$"])
annotation_string = r"$I_{ext}=0.5$"
plt.text(15, 60, annotation_string, bbox=dict(facecolor='red', alpha=0.5))
plt.show()
Typo:ha ='left'。 – swatchai
歡呼的隊友!更正它。 – ImportanceOfBeingErnest
有一個更簡單的方法可以做到這一點,而不必(直接)使用'transform'http://matplotlib.org/users/annotations.html#basic-annotation use'textcoords'和'xycoords'。 – tacaswell