Skip to contents

Similar to sp_x_axis, but for the y-axis. This function customizes the appearance and scaling of the y-axis, including label formatting, tick marks, and label and tick colors.

Usage

sp_y_axis(
  sp,
  format = NULL,
  scale = "linear",
  ticks = 6,
  label = NULL,
  font_size_label = 14,
  font_size_ticks = 12,
  color_ticks = "black",
  color_label = "black"
)

Arguments

sp

A SveltePlot htmlwidget object.

format

Character string specifying the format of the x-axis labels. This should correspond to valid D3 format strings. Default is NULL. Documentation for the formats are here https://d3js.org/d3-format.

scale

Character string indicating the scale type of the axis. Can be either "linear" or "log" for logarithmic. Default is "linear".

ticks

Numeric value indicating the suggested number of tick marks. D3 will ultimately decide the exact number of ticks based on this suggestion. Default is 6.

label

Character string for the label of the x-axis. Default is NULL.

font_size_label

Numeric value specifying the font size of the x-axis label. Default is 14.

font_size_ticks

Numeric value specifying the font size of the tick labels on the x-axis. Default is 12.

color_ticks

Character string specifying the color of the tick labels on the x-axis. Default is "black".

color_label

Character string specifying the color of the x-axis label. Default is "black".

Examples

if (FALSE) { # \dontrun{
library(SveltePlots)
# Assume `economics` data and prior `sp` and `sp_x_axis` calls
sp(...) |>
  sp_y_axis(label = "Unemployment", font_size_label = 18, font_size_ticks = 14)
} # }