Skip to content

Instantly share code, notes, and snippets.

@tonyfast
Forked from michaelaye/hvplotting.py
Last active May 14, 2020 02:26
Show Gist options
  • Save tonyfast/a517048c80a0e43cd43e48e131551ea6 to your computer and use it in GitHub Desktop.
Save tonyfast/a517048c80a0e43cd43e48e131551ea6 to your computer and use it in GitHub Desktop.
def plot_loglog(self, country, freq="2d"):
newdf = self.get_country(country)
return (
newdf.resample(freq)
.mean()
.hvplot.scatter(
x="Infections",
y="Rate",
logy=True,
logx=True,
ylim=(1, None),
xlim=(1, None),
label=country,
)
)
def plot_loglog_countries(self, countries):
if len(countries) == 1:
return self.plot_loglog(countries[0])
else:
return self.plot_loglog(countries[0]) * self.plot_loglog_countries(
countries[1:]
)
def plot_loglog_countries_listcmp(self, countries):
return holoviews.Overlay([
plot_loglog(country) for country in countries
])
def plot_loglog_countries_inc(self, countries):
plot = plot_loglog(countries[0])
for country in countries[1:]:
plot *= plot_loglog(country)
return plot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment