bubble_plot | R Documentation |
bubble_plot
produces a ggplot bubble plot from a data.frame
bubble_plot(
plot_df,
x = "x",
y = "y",
size = "size",
fill = "fill",
x_labels = NULL,
y_labels = NULL,
...
)
plot_df |
data.frame data to plot |
x |
character Name of the variable to plot on the x-axis |
y |
character Name of the variable to plot on the y-axis |
size |
character Name of the variable to use for the size of the points |
fill |
character Name of the variable to use for the fill colour |
x_labels |
character Optional labels to use instead of levels of x-axis variable |
y_labels |
character Optional labels to use instead of levels of y-axis variable |
... |
Other arguments passed on to |
This function takes a data.frame and creates a bubble plot. An x-y scatterplot where an attribute is represented by the size of the points and optionally an another attribute is mapped to the colour.
plot - ggplot2 object
set.seed(20962)
test_data_cat <- data.frame(x = factor(rep(LETTERS[1:10], 10)),
y = factor(rep(1:10, each = 10), levels = 10:1),
size = sample(20:100, 100, replace = TRUE),
fill = runif(100))
cat_bubble_plot <- bubble_plot(test_data_cat)
test_data_num <- test_data_cat
test_data_num$x <- sample(1:50, 20)
test_data_num$y <- sample(1:50, 20)
num_bubble_plot <- bubble_plot(test_data_num)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.