scale_x_piece  R Documentation 
scale_x_piece()
and scale_y_piece()
are wrappers
around ggplot2::scale_x_continuous()
and
ggplot2::scale_y_continuous()
with "better"
defaults for board game diagrams.
label_letter()
labels breaks with letters
and label_counting()
labels breaks with positive integers
to more easily generate (i.e. chess) algebraic notation coordinates.
breaks_counting()
generates breaks of just the positive integers within the limits.
scale_x_piece(
...,
name = NULL,
breaks = breaks_counting(),
minor_breaks = NULL,
labels = label_letter()
)
scale_y_piece(
...,
name = NULL,
breaks = breaks_counting(),
minor_breaks = NULL,
labels = label_counting()
)
label_letter()
label_counting()
breaks_counting()
... 
Passed to 
name 
The name of the scale. Used as the axis or legend title. If

breaks 
One of:

minor_breaks 
One of:

labels 
One of:

scale_x_piece()
and scale_y_piece()
return ggplot2 scale objects.
label_letter()
and label_counting()
return functions suitable for use with the labels
scale argument.
breaks_counting()
returns a function suitable for use with the breaks
scale argument.
if (require("ggplot2", quietly = TRUE) && require("tibble", quietly = TRUE)) {
envir < game_systems("sans")
df_board < tibble(piece_side = "board_face", suit = 3, rank = 8,
x = 4.5, y = 4.5)
df_w < tibble(piece_side = "bit_face", suit = 6, rank = 1,
x = rep(1:8, 2), y = rep(1:2, each=8))
df_b < tibble(piece_side = "bit_face", suit = 1, rank = 1,
x = rep(1:8, 2), y = rep(7:8, each=8))
df < rbind(df_board, df_w, df_b)
# `cfg` must be a character vector for `geom_piece()`
ggplot(df, aes_piece(df)) +
geom_piece(cfg = "checkers1", envir = envir) +
coord_fixed() +
scale_x_piece() +
scale_y_piece() +
theme_minimal(28) +
theme(panel.grid = element_blank())
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.