scale-continuous | R Documentation |
Axis scale for continuous data
v_scale_x_continuous(
vc,
name = NULL,
breaks = NULL,
pretty = TRUE,
labels = NULL,
labels_tooltip = labels,
zero = NULL,
min = NULL,
max = NULL,
...,
position = "bottom"
)
v_scale_y_continuous(
vc,
name = NULL,
breaks = NULL,
pretty = TRUE,
labels = NULL,
labels_tooltip = labels,
zero = NULL,
min = NULL,
max = NULL,
...,
position = "left"
)
v_scale_x_log(
vc,
name = NULL,
breaks = NULL,
pretty = TRUE,
labels = NULL,
labels_tooltip = labels,
zero = NULL,
min = NULL,
max = NULL,
...,
position = "bottom"
)
v_scale_y_log(
vc,
name = NULL,
breaks = NULL,
pretty = TRUE,
labels = NULL,
labels_tooltip = labels,
zero = NULL,
min = NULL,
max = NULL,
...,
position = "left"
)
vc |
An htmlwidget created with |
name |
Title for the axis. |
breaks |
One of:
|
pretty |
Use |
labels , labels_tooltip |
The format to be applied on numeric in the labels/tooltip. Either:
|
zero |
Force axis to start at 0. |
min |
Minimum value on the axis. |
max |
Maximum value on the axis. |
... |
Additional parameters for the axis. |
position |
Position of the axis. |
A vchart()
htmlwidget
object.
library(vchartr)
# Add a title to the axis
vchart(top_generation) %>%
v_bar(aes(country, electricity_generation)) %>%
v_scale_y_continuous(name = "Electricity generation")
vchart(subset(world_electricity, type == "total")) %>%
v_bar(aes(year, generation, fill = source)) %>%
v_scale_y_continuous(name = "Electricity generation")
# Specify number of breaks
vchart(top_generation) %>%
v_bar(aes(country, electricity_generation)) %>%
v_scale_y_continuous(breaks = 10)
# Specify breaks position
vchart(top_generation) %>%
v_bar(aes(country, electricity_generation)) %>%
v_scale_y_continuous(breaks = c(0, 5000, 10000))
# Format labels
vchart(top_generation) %>%
v_bar(aes(country, electricity_generation)) %>%
v_scale_y_continuous(labels = "~s")
# Format labels with options
vchart(top_generation) %>%
v_bar(aes(country, electricity_generation)) %>%
v_scale_y_continuous(labels = format_num_d3(",", suffix = " TWh", locale = "fr-FR"))
vchart(subset(world_electricity, type == "total")) %>%
v_bar(aes(year, generation, fill = source)) %>%
v_scale_y_continuous(labels = format_num_d3(",", suffix = " TWh", locale = "fr-FR"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.