Boxed geom_text with ggplot2

后端 未结 7 494
迷失自我
迷失自我 2021-01-03 23:40

I am developing a graphic with ggplot2 wherein I need to superimpose text over other graphical elements. Depending on the color of the elements underlying the text, it can b

7条回答
  •  心在旅途
    2021-01-04 00:38

    In the development version of ggplot2 package there is a new geom called geom_label() that implements this directly. Transperency can be atchieved with alpha= parameter.

    ggplot(data = SampleFrame,
           aes(x = X, y = Y)) + geom_point(size = 20)+ 
            geom_label(data = TextFrame,
                             aes(x = X, y = Y, label = LAB),alpha=0.5)
    

提交回复
热议问题