plot_fen: Visualise a FEN

Description Usage Arguments Details Value Examples

View source: R/plot-fen.R

Description

Visualise a FEN

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
plot_fen(
  fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
  perspective = "w",
  palette = "brown",
  piece_scale = 0.825,
  show_coords = TRUE,
  show_fen = FALSE,
  news_spacing = 0.12,
  news_thickness = 0.5,
  border_col = NA,
  border_size = 0.5
)

Arguments

fen

a character vector FEN of length one (defaults to the opening position)

perspective

view board from white "w" or black "b" perspective (default = "w")

palette

A single character colour theme listed below or a length 2 vector of colours ordered dark, light (default = "brown")

  • "brown"

  • "blue"

  • "blue2"

  • "green"

  • "grey"

  • "pink"

  • "purple"

  • "ic"

  • "news"

piece_scale

scaling factor for piece sizes (default = 0.825)

show_coords

logical - should the board coordinates be printed? (default = TRUE)

show_fen

logical - should the FEN be printed in the plot caption? (default = FALSE)

news_spacing

spacing of shading lines if palette = "news" (default = 0.12)

news_thickness

thickness of shading lines if palette = "news" (default = 0.5)

border_col

Chess board border colour (default = NA (no border))

border_size

Chess board border size (default = 0.5)

Details

Chess piece SVG design file downloaded from https://commons.wikimedia.org/wiki/File:Chess_Pieces_Sprite.svg

jurgenwesterhof (adapted from work of Cburnett), CC BY-SA 3.0 <https://creativecommons.org/licenses/by-sa/3.0>, via Wikimedia Commons

Value

A ggplot2 plot object

Examples

1
2
3
4
5
# Plot the starting position
plot_fen('Q1b2rk1/p1p2p1p/6Bp/2b5/8/2P5/P1P2PPP/R4RK1 b - - 0 16')

# Plot an empty board
plot_fen("8/8/8/8/8/8/8/8 w KQkq - 0 1")

cj-holmes/ggambit documentation built on July 22, 2021, 12:56 p.m.