Uses the reticulate framework to access the Altair API.

alt

Format

An object of class python.builtin.module (inherits from python.builtin.object) of length 1.

Details

The Altair Python package is exposed through the alt object. You can create and add to chart using its methods and classes, as outlined in the Altair Python documentation.

In this package, use the $ operator wherever you see the . operator used in Python.

Examples

if (interactive()) {
  vega_data <- import_vega_data()

  plot_basic <-
    alt$Chart(vega_data$cars())$
    encode(
      x = "Miles_per_Gallon:Q",
      y = "Horsepower:Q",
      color = "Origin:N"
    )$
    mark_point()

   plot_basic
}