Example: Embedding Altair & Hvplot Charts
This post will show examples of embedding interactive charts produced using Altair and Hvplot.
Altair Example
Below is a chart of the incidence of measles since 1928 for the 50 US states.
This was produced using Altair and embedded in this static web page. Note that you can also display Python code on this page:
import altair as alt
alt.renderers.enable('notebook')
HvPlot Example
Lastly, the measles incidence produced using the HvPlot package:
Notes
- See the raw source code of this post for details on how these charts were embedded.
- See the lecture 13A slides for the code that produced these plots.
Important: When embedding charts, you will likely need to adjust the width/height of the charts before embedding them in the page so they fit nicely when embedded.