I am new to hvplot and trying to include a call to .hvplot() inside a function definition, but it's not working. The following code works and displays a figure as expected:
.hvplot()
import pandas as pd import hvplot.pandas df = pd.DataFrame([1, 5, 3, 4, 2]) df.hvplot()
but if I try something like:
def plot(df): df.hvplot() plot(df)
I get no output. This is in a Jupyter Notebook. What am I missing?
You need to return the result of your function:
def plot(df): return df.hvplot() plot(df)
Or:
def plot(df): my_plot = df.hvplot() return my_plot plot(df)
1.4m articles
1.4m replys
5 comments
56.9k users