python - matplotlib discrete data versus continuous function -
i need plot ratio between function introduced thorough discrete data set, imported text file, example:
x,y,z=np.loadtxt('example.txt',usecols=(0,1,2),unpack=true)
,
and continuous function defined using np.arange command, example:
w=np.arange(0,0.5,0.01)
exfunct=w**4
.
clearly, solutions as
plt.plot(w,1-(x/w),'k--',color='blue',lw=2)
well
plt.plot(y,1-(x/w),'k--',color='blue',lw=2)
do not work. despite having looked answer in site (and outside it), can not find solution problem. should fit discrete data set, obtain continuous function, , define in same interval "exfunct"? suggestion? thank lot.
at end solution has been easier thought. had define continuous variable through discrete data, as, example:
w=x/y
,
then define function said:
exfunct=w**4
and plot "continuous-discrete" function:
plt.plot(x,x/exfunct),'k-',color='red',lw=2)
i hope can useful.
Comments
Post a Comment