Axis scale for continuous data
scale-continuous.RdAxis scale for continuous data
Usage
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")Arguments
- vc
An htmlwidget created with
vchart()or specific chart's type function.- name
Title for the axis.
- breaks
One of:
A single
numericvalue giving the number of breaks.A numeric vector of positions.
- pretty
Use
pretty()to identify breaks ifbreaksis a single numeric value.- labels, labels_tooltip
The format to be applied on numeric in the labels/tooltip. Either:
A single character indicating the D3 format.
A
JSfunction, such asformat_num_d3().
- 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.
Value
Avchart()htmlwidget object.
Examples
library(vchartr)# Add a title to the axisvchart(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 breaksvchart(top_generation)%>%v_bar(aes(country,electricity_generation))%>%v_scale_y_continuous(breaks=10)# Specify breaks positionvchart(top_generation)%>%v_bar(aes(country,electricity_generation))%>%v_scale_y_continuous(breaks=c(0,5000,10000))# Format labelsvchart(top_generation)%>%v_bar(aes(country,electricity_generation))%>%v_scale_y_continuous(labels="~s")# Format labels with optionsvchart(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"))