powered by
Scatter plot from a long data.frame with columns named x, value, and variable.
x
value
variable
plot_scatter(data, label_x = "", label_y = "", colors = NULL)
return a ggplot2::ggplot graphic
long data.frame with columns x, value, variable
x‑axis label
y‑axis label
optional color(s); for numeric variable, supply a gradient as c(low, high)
Colors are mapped to variable. If variable is numeric, a gradient color scale is used when colors is provided.
colors
grf <- plot_scatter(iris |> dplyr::select(x = Sepal.Length, value = Sepal.Width, variable = Species), label_x = "Sepal.Length", label_y = "Sepal.Width", colors=c("red", "green", "blue")) plot(grf)
Run the code above in your browser using DataLab