# =========================== ## Author: Andrin Riss ## Created: 22.10.20 ## Last modfied: 24.10.20 ## Modified by: Andrin Riss ## R version: 4.0.2 ## RStudio version: 1.3.1093 # =========================== WordArt <- function( myname = "Word-Art", font = "mono") { # Function to create "WordArt" plots. # Usage: WordArt("Ismael", "sans") # Pacjkages Needed require("randomcoloR") # Split the string into characters myname_split <- unlist(strsplit(myname, "")) # Get number of characters in myname (needed later in plot) myname_length <- nchar(myname) # Prepare Plot Canvas plot( NULL, xlim = c(1,(myname_length + 2)), ylim = c(1,2), type = "n", axes = T, bty = "n", xlab = "", ylab = "", ) # Font fonts <- list( sans = "Helvetica", mono = "Courier", serif = "Times" ) # Plot Colored Text i <- 1 while (i <= myname_length) { text( x = 1+i, y = runif(1, 1.2, 1.8), labels = myname_split[i], cex = runif(1, 6, 9), col = randomColor(hue = "blue"), family = font) i = i + 1 } } # I assume there exist functions which produce much more aesthetic "WordArts" # but I think as a first attempt this one's okay too.