Create a fretboard diagram for a single chord or a general progression.

plot_fretboard(
  string,
  fret,
  labels = NULL,
  mute = FALSE,
  label_size = 10,
  label_color = "white",
  point_size = 10,
  point_color = "black",
  point_fill = "black",
  group = NULL,
  horizontal = FALSE,
  left_handed = FALSE,
  fret_range = NULL,
  accidentals = c("flat", "sharp"),
  tuning = "standard",
  show_tuning = FALSE,
  asp = NULL,
  base_size = 20
)

plot_chord(
  chord,
  labels = NULL,
  label_size = 10,
  label_color = "white",
  point_size = 10,
  point_color = "black",
  point_fill = "black",
  group = NULL,
  horizontal = FALSE,
  left_handed = FALSE,
  fret_range = NULL,
  accidentals = c("flat", "sharp"),
  tuning = "standard",
  show_tuning = FALSE,
  asp = NULL,
  base_size = 20
)

Arguments

string

integer or as a space-delimited character string; instrument string numbers.

fret

integer or as a space-delimited character string; fret numbers.

labels

character, optional text labels, must be one for every point.

mute

logical vector or specific integer indices, which notes to mute.

label_size

numeric, size of fretted note labels.

label_color

character, label color.

point_size

numeric, size of fretted note points.

point_color

character, point color.

point_fill

character, point fill color.

group

optional vector to facet by.

horizontal

logical, directional orientation.

left_handed

logical, handedness orientation.

fret_range

fret limits, if not NULL, overrides limits derived from fret.

accidentals

character, when labels = "notes" represent accidentals: "flat" or "sharp".

tuning

explicit tuning, e.g., "e, a, d g b e'", or a pre-defined tuning. See details.

show_tuning

logical, show tuning of each string.

asp

numeric, aspect ratio, overrides default aspect ratio derived from number of strings and frets.

base_size

base size for ggplot2::theme_void().

chord

character, a single chord given in fret notation. See details.

Value

a ggplot object

Details

These functions are under development and subject to change. They each return a ggplot object.

Use plot_chord() to create a fretboard diagram of a specific chord. plot_chord() accepts a character string in simple fretboard format, e.g., chord = "xo221o". Zero is allowed in place of "o". This only works when no spaces or semicolons are detected. The function checks for spaces first, then semicolons, to split fret numbers. Do not mix formats. For example, you can use chord = "xo221o", chord = "x 8 10 10 9 8" or chord = "x;8;10;10;9;8". Trailing delimiters are ignored (LilyPond format: "x;8;10;10;9;8;"). If there are fewer fret values than there are strings on the instrument, as inferred from tuning, then muted strings, x, are inferred for the remaining lower-pitch strings.

plot_fretboard() produces a more general fretboard diagram plot. It is intended for scales, arpeggios and other patterns along the fretboard. For this function, provide vectors of string and fret numbers. mute is available but not as applicable for this function. For single chord diagrams, use plot_chord().

Number of strings is derived from tuning. See tunings() for pre-defined tunings and examples of explicit tunings. tuning affects point labels when labels = "notes".

Examples

# General patterns: scale shifting exercise
string <- c(6, 6, 6, 5, 5, 5, 4, 4, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1)
fret <- "2 4 5 2 4 5 2 4 6 7 9 6 7 9 7 9 10 7 9 10" # string input accepted
plot_fretboard(string, fret, labels = "notes")


# Single chord diagrams
# open chord
idx <- c(1, 1, 2, 2, 2, 1)
fill <- c("white", "black")[idx]
lab_col <- c("black", "white")[idx]
plot_chord("xo221o", "notes", label_color = lab_col, point_fill = fill)


# moveable chord
plot_chord("355433", horizontal = TRUE, show_tuning = TRUE)


plot_chord("0231") # leading x inferred; same as plot_chord("xxo321")


plot_chord("10 12 13 11", fret_range = c(10, 14))