powered by
This function creates a scatter plot using ggplot2.
plot_scatter(data, label_x = "", label_y = "", colors = NULL)
return a ggplot2::ggplot graphic
data.frame contain x, value, and variable
x-axis label
y-axis label
color vector
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