## ----setup, include = FALSE--------------------------------------------------- library(glyph) knitr::opts_chunk$set(fig.width = 7, fig.height = 4.5) ## ----------------------------------------------------------------------------- glyph(mtcars, x = wt, y = mpg) |> mark_point(color = cyl, style = list(size = 6)) |> scale_color("Set2") |> scale("x", label = "Weight (1000 lbs)") |> scale("y", label = "Miles per Gallon") |> titles(title = "Motor Trend Cars") |> theme_tokens(preset = "minimal") |> render() ## ----------------------------------------------------------------------------- glyph(mtcars, x = wt, y = mpg) |> mark_point(color = cyl) |> interact( tooltip = "{cyl} cyl, {mpg} mpg at {wt} tons", zoom = TRUE, brush = TRUE, hover = "enlarge" ) |> render() ## ----------------------------------------------------------------------------- p1 <- glyph(mtcars, x = wt, y = mpg) |> mark_point(color = cyl) |> interact(brush = TRUE) p2 <- glyph(mtcars, x = hp, y = mpg) |> mark_point(color = cyl) |> interact(brush = TRUE) compose(p1, p2, type = "hstack", linked_selections = TRUE) |> render() ## ----------------------------------------------------------------------------- glyph(mtcars, x = wt, y = mpg) |> mark_point(color = cyl) |> marginals(x = "histogram", y = "density", size = 0.2) |> render()