Last active
January 9, 2022 04:41
-
-
Save MarcSkovMadsen/c9b2af4ff05aa5766da4132a86b68c5b to your computer and use it in GitHub Desktop.
Basic Examples for the blog post "I prefer using Panel for my Data Apps. Here is why"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# run: pip install pandas panel hvplot | |
import panel as pn | |
import pandas as pd, numpy as np | |
import hvplot.pandas # noqa | |
primary_color="#3E5F8A" | |
secondary_color="#EA899A" | |
idx = pd.date_range('1/1/2000', periods=1000) | |
df1 = pd.DataFrame(np.random.randn(1000, 1), index=idx, columns=list('A')).cumsum() | |
df2 = pd.DataFrame(np.random.randn(1000, 1), index=idx, columns=list('B')).cumsum() | |
p1 = df1.hvplot(width=700, line_width=4, color=primary_color) | |
p2 = df2.hvplot(width=700, line_width=4, color=secondary_color) | |
overlay = (p1*p2).opts(width=1400) | |
layout = (p1+p2) | |
pn.template.FastListTemplate( | |
site="Panel", title="Hvplot Example", | |
main=[overlay, layout], | |
accent_base_color=primary_color, header_background=secondary_color | |
).servable() | |
# run: panel serve panel_hvplot_getting_started.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment