render_chordchart | R Documentation |
Render a standalone chord chart of chord fretboard diagrams with LilyPond for a set of chords.
render_chordchart(
chords,
file,
size = 1.2,
header = NULL,
paper = NULL,
colors = NULL,
crop_png = TRUE,
transparent = FALSE,
res = 150,
keep_ly = FALSE,
details = FALSE
)
chords |
named character vector of valid formatting for LilyPond chord names and values. See examples. |
file |
output file. |
size |
numeric, size of fretboard diagrams (relative to paper font size). Use this to scale diagrams up or down. |
header |
a named list of arguments passed to the header of the LilyPond file. See details. |
paper |
a named list of arguments for the LilyPond file page layout. See details. |
colors |
reserved; not yet implemented for this function. |
crop_png |
logical, see |
transparent |
logical, transparent background, png only. |
res |
numeric, resolution, png only. |
keep_ly |
logical, keep intermediate LilyPond file. |
details |
logical, set to |
This function uses a generates a LilyPond template for displaying only a
fretboard diagram chart. It then passes the file to LilyPond for rendering.
To plot specific fretboard diagrams in R using ggplot and with greater
control, use plot_fretboard()
.
The options for paper
include the following and have the following
default values if not provided.
textheight = 220
linewidth = 150
indent = 0
fontsize = 10
page_numbers = FALSE
print_first_page_number = TRUE
first_page_number = 1
fontsize
only controls the global font size. If you want to scale the
size of the fretboard diagrams up or down use the the size
argument
rather than this paper
value.
Note that chord chart output must fit on a single page. If the full set of
chord diagrams does not fit on one page then diagrams will be clipped in the
rendered output. Use size
to keep the output to one page or make
multiple sheets separately.
writes files to disk
plot_fretboard()
, lilypond()
,
tab()
suppressPackageStartupMessages(library(dplyr))
chords <- filter(
guitarChords, root %in% c("c", "f") & id %in% c("7", "M7", "m7") &
!grepl("#", notes) & root_fret <= 12) |>
arrange(root, id)
chords <- setNames(chords$fretboard, chords$lp_name)
head(chords)
# requires LilyPond installation
if(tabr_options()$lilypond != ""){
outfile <- file.path(tempdir(), "out.pdf")
hdr <- list(
title = "Dominant 7th, major 7th and minor 7th chords",
subtitle = "C and F root"
)
render_chordchart(chords, outfile, 2, hdr, list(textheight = 175))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.