I have two python files, one is func.py
where in this file I define the function
import matplotlib.pyplot as plt
def lineplot(x,y,clip):
fig, ax = plt.subplots()
ax.plot(x,y,'k-', linewidth=0.2)
ax.plot(lo,la,marker='.', color='r')
Then, in my second file main.ipynb
, I call this function
import func as f
f.lineplot(x,y,clip)
I run main.ipynb
and it has an error name lo is not given
.
I find lo
and la
in function lineplot
are not in the argument list. So I change func.py
as
import matplotlib.pyplot as plt
def lineplot(x,y,clip,lo,la):
fig, ax = plt.subplots()
ax.plot(x,y,'k-', linewidth=0.2)
ax.plot(lo,la,marker='.', color='r')
After that, I revise main.ipynb
,
import func as f
f.lineplot(x,y,clip,lo,la)
but this time it gives me an error:
lineplot() takes 3 positional arguments but 5 were given
Does anybody know why it happens and how to fix it? I use Jupyter notebook.