alt: Altair object

altR Documentation

Altair object

Description

Uses the reticulate framework to access the Altair API.

Usage

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.

See Also

Altair Python documentation, altair: Field Guide to Python Issues

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
}


altair documentation built on Sept. 4, 2023, 9:06 a.m.