This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Programmatically create a document" | |
date: "`r Sys.Date()`" | |
output: | |
pagedown::html_paged: | |
toc: true | |
# change to true for a self-contained document, but it'll be a litte slower for Pandoc to render | |
self_contained: false | |
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(FField) | |
# You'll have to play with repulsion, cex.x, and cex.y to get satisfactory results. | |
plot_text <- function(x, y, label, repulsion = 1, cex.x = 110, cex.y = 40) { | |
dat <- data.frame(xpos = x, ypos = y, label = label) | |
dat$label <- as.character(dat$label) | |
# Use the FField package to repel the text labels away from each other. | |
dat <- cbind( |
NewerOlder