tabr (version 0.3.5)

fretboard_plot: Fretboard plot

Description

Create a fretboard diagram.

Usage

fretboard_plot(string, fret, labels = NULL, mute = FALSE,
  label_size = 4, label_color = "white", point_size = 10,
  point_color = "black", point_fill = "black", group = NULL,
  horizontal = FALSE, left_handed = FALSE, fret_range = NULL,
  key = "c", tuning = "standard", show_tuning = FALSE)

Arguments

string

integer or as tabr-style character string, string numbers.

fret

integer or as tabr-style character string, fret numbers.

labels

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

mute

logical, whether to mute notes, typically a vector corresponding to string and fret.

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.

key

character, key signature, used to enforce type of accidentals when labels = "notes".

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.

Value

a ggplot object

Details

This function is under development and subject to change.

Create a fretboard diagram ggplot object. 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

Run this code
# NOT RUN {
# open chord
am_frets <- c(0, 0, 2, 2, 1, 0) # first note will be muted; 'x' is drawn at 0
idx <- c(1, 1, 2, 2, 2, 1)
fill <- c("white", "black")[idx]
lab_col <- c("black", "white")[idx]
mute <- c(TRUE, rep(FALSE, 5))
fretboard_plot(6:1, am_frets, "notes", mute, label_color = lab_col,
               point_fill = fill)

# moveable chord
fretboard_plot(6:1, am_frets, mute = mute, point_fill = fill,
               fret_range = c(0, 4), horizontal = TRUE, show_tuning = TRUE)

# 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
fretboard_plot(string, fret, labels = "notes")
# }

Run the code above in your browser using DataLab