v_scatter | R Documentation |
Create a Scatter Chart
v_scatter(
vc,
mapping = NULL,
data = NULL,
name = NULL,
...,
serie_id = NULL,
data_id = NULL
)
vc |
A chart initialized with |
mapping |
Default list of aesthetic mappings to use for chart. |
data |
Default dataset to use for chart. If not already
a |
name |
Name for the serie, only used for single serie (no |
... |
Additional parameters for the serie. |
data_id , serie_id |
ID for the data/serie, can be used to further customize the chart with |
A vchart()
htmlwidget
object.
library(vchartr)
data("penguins", package = "palmerpenguins")
# Basic scatter chart
vchart(penguins) %>%
v_scatter(aes(x = flipper_length_mm, y = body_mass_g))
# Color series with discrete values
vchart(penguins) %>%
v_scatter(aes(x = flipper_length_mm, y = body_mass_g, color = species))
# Color series with continuous values
vchart(penguins) %>%
v_scatter(aes(x = bill_length_mm, y = bill_depth_mm, color = body_mass_g))
# Size of points
vchart(penguins) %>%
v_scatter(aes(x = bill_length_mm, y = bill_depth_mm, size = body_mass_g))
# Size and color
vchart(penguins) %>%
v_scatter(aes(
x = bill_length_mm,
y = bill_depth_mm,
color = body_mass_g,
size = body_mass_g
))
# With shapes
vchart(penguins) %>%
v_scatter(
aes(
x = bill_length_mm,
y = bill_depth_mm,
color = species,
shape = species
)
)
vchart(penguins) %>%
v_scatter(
aes(x = flipper_length_mm, y = body_mass_g, color = species)
) %>%
v_scale_color_manual(c(
Adelie = "#ffa232",
Chinstrap = "#33a2a2",
Gentoo = "#b34df2"
))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.