Outlined text with ggplot2

前端 未结 4 752
走了就别回头了
走了就别回头了 2020-12-23 16:55

I\'d like to know if there is a way to draw \"outlined text\" with ggplot2, for example black text with a small white border, in order to make it easily readable on backgrou

4条回答
  •  长情又很酷
    2020-12-23 17:13

    The accepted answer by Greg Snow doesn't work anymore with ggplot2@2.2.1 because of the call of aes instead of aes_q.

    Use

    for(i in theta) {
      p <- p + geom_text( 
        aes_q(x = bquote(carat+.(cos(i)*xo)),
              y = bquote(price+.(sin(i)*yo)),
              label = ~cut), 
        size=12, colour='black' )
    }
    

    instead.

提交回复
热议问题