Agregue llaves para ggplot2 y luego use ggsave

Esto es muy relevante para estopregunta y estoresponder Es una excelente solución. El problema es que cuando intento exportar el gráfico usando ggsave, las llaves no están presentes.

ejemplo:

library(ggplot2)
library(grid)
library(pBrackets) 
x <- c(runif(10),runif(10)+2)
y <- c(runif(10),runif(10)+2)
the_plot <- qplot(x=x,y=y) +
  scale_x_continuous("",breaks=c(.5,2.5),labels=c("Low types","High types") ) +
  theme(axis.ticks = element_blank(),
        axis.ticks.length = unit(.85, "cm"))
the_plot
grid.locator(unit="native") 
bottom_y <- 284 
grid.brackets(220, bottom_y,   80, bottom_y, lwd=2, col="red")
grid.brackets(600, bottom_y,  440, bottom_y, lwd=2, col="red")
ggsave("test.png",width = 4, height = 2.5)

No estoy dispuesto a usar el botón de exportación de RStudio, ya que no exporta correctamente los tamaños de fuente de mi tema, etc. También necesito una resolución superior a 76 ppp. Necesito una solución para agregar llaves a un gráfico ggplot2 y poder guardarlo usando ggsave.

Respuestas a la pregunta(2)

Su respuesta a la pregunta