Plotting from command line script

I’m looking for the required code lines required to open the plot in the system default matplotlib backend when called the plot as a command line script?

Simpy adding plt.show() didn’t cut it…

My code is a very simple dataframe in tidy layout with pet weights.
Plot command is:

df.hvplot(x='date', y='weight [kg]', by='Pet', kind='scatter')
# tried this to no avail
plt.show()

and imports related to pyviz so far:

import hvplot.pandas
import matplotlib.pyplot as plt

hvPlot does not (officially) support matplotlib. The best you’ll be able to do is:

import hvplot

p = df.hvplot(x='date', y='weight [kg]', by='Pet', kind='scatter')
hvplot.show(p)
1 Like

ok, thanks! But your solution still requires the standard

import hvplot.pandas

to activate the monkeypatches.