Tooltips have changed - and so shall this article. Watch this space.
library("altair") vega_data <- import_vega_data() chart <- alt$Chart(vega_data$cars$url)$ mark_point()$ encode( x = "Horsepower:Q", y = "Miles_per_Gallon:Q", color = "Origin:N" ) chart
For the time-being, we can make tooltips only for a single encoding. We are waiting for the Altair package to catch-up to the vega-tooltip changes; the Altair folks are waiting for their renderers to catch up.
chart <- alt$Chart(vega_data$cars$url)$ mark_point()$ encode( x = "Horsepower:Q", y = "Miles_per_Gallon:Q", color = "Origin:N", tooltip = list( alt$Tooltip(field = "Miles_per_Gallon", type = "quantitative"), alt$Tooltip(field = "Horsepower", type = "quantitative") ) ) chart
examine(chart)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.