PaulB
PaulB

Reputation: 319

r: add text to plot without it getting cutoff

I'm playing with the riverplot package, and I'm trying to add text to the plot as labels for each period. I'd like to add the text at the bottom of the plot, but it gets cut off.

How can I add text near the parameter of a plot without it being cutoff?

library(riverplot)
library(tidyverse)

river <- riverplot.example()
test <- plot(river,plot_area=0.9)

labels <- as_tibble(distinct(test$nodes["x"])) %>%
    dplyr::mutate(y=0) %>%
    dplyr::mutate(label="your \n text \n here")


text(labels$x,labels$y,labels=labels$label,cex=1,pos=1)

Upvotes: 0

Views: 673

Answers (0)

Related Questions