-
-
Save yannabraham/5f210fed773785d8b638 to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt is missing from the imports
and
sns.plt.plot needs to be modified to plt.plot
for fit in fitData:
plt.plot([pDose(i) for i in refDose],[ll4(i,*[fit[i] for i in ['b','c','d','e']]) for i in refDose])
Thanks! Fixed the code as you suggested, should work now @akashbahai @cbmII
How would you go about implementing a 1/Y^2 weighting and returning their parameter values as well as visualising the line on the graph?
Hey @Fae14, this link should give you a few pointers:
https://stackoverflow.com/questions/27696324/using-scipy-optimize-curve-fit-with-weights
Hope this helps!
Nice attempt. May be code should be more explanatory and have more comments,
Copied as-is into a new jupyter session, I get the following after assigning fitCompound
:
[/var/folders/2s/9l3t4cfj0c5g1s4_7shzc5900000gp/T/ipykernel_19131/1118045928.py:7](http://localhost:8888/var/folders/2s/9l3t4cfj0c5g1s4_7shzc5900000gp/T/ipykernel_19131/1118045928.py#line=6): RuntimeWarning: invalid value encountered in log
return(c+(d-c)[/](http://localhost:8888/)(1+np.exp(b*(np.log(x)-np.log(e)))))
Then a type error making the lmplot:
TypeError Traceback (most recent call last)
Cell In[81], line 3
1 refDose = np.linspace(min(drData.logDose)*0.9,max(drData.logDose)*1.1,256)
2 refDose = (10**-refDose)*1e6
----> 3 sns.lmplot('logDose','response',data=drData,hue='compound',fit_reg=False)
4 for fit in fitData:
5 plt.plot([pDose(i) for i in refDose],[ll4(i,*[fit[i] for i in ['b','c','d','e']]) for i in refDose])
TypeError: lmplot() got multiple values for argument 'data'
Copied as-is into a new jupyter session, I get the following after assigning
fitCompound
:[/var/folders/2s/9l3t4cfj0c5g1s4_7shzc5900000gp/T/ipykernel_19131/1118045928.py:7](http://localhost:8888/var/folders/2s/9l3t4cfj0c5g1s4_7shzc5900000gp/T/ipykernel_19131/1118045928.py#line=6): RuntimeWarning: invalid value encountered in log return(c+(d-c)[/](http://localhost:8888/)(1+np.exp(b*(np.log(x)-np.log(e)))))
Then a type error making the lmplot:
TypeError Traceback (most recent call last) Cell In[81], line 3 1 refDose = np.linspace(min(drData.logDose)*0.9,max(drData.logDose)*1.1,256) 2 refDose = (10**-refDose)*1e6 ----> 3 sns.lmplot('logDose','response',data=drData,hue='compound',fit_reg=False) 4 for fit in fitData: 5 plt.plot([pDose(i) for i in refDose],[ll4(i,*[fit[i] for i in ['b','c','d','e']]) for i in refDose]) TypeError: lmplot() got multiple values for argument 'data'
I have the same problem, anyone found a solution?
I am getting this error. I checked and found that there is no plt.plot in seaborn.
sns.plt.plot([pDose(i) for i in refDose],[ll4(i,*[fit[i] for i in ['b','c','d','e']]) for i in refDose])
AttributeError: 'module' object has no attribute 'plt'