更改文本注释的背景颜色以增加对比度和可见性 [英] Changing background color for a text annotation to increase contrast and visibility
本文介绍了更改文本注释的背景颜色以增加对比度和可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想更改带注释文本的背景颜色,使其为绿色并覆盖其后面的所有内容(例如下面示例中的水平线).我该怎么办?
I'd like to change the background color for my annotate text so that it's green and covers up anything behind it (like the horizontal line in the example below). How do I do that?
ggplot() +
geom_hline(yintercept=0) +
annotate("text",x=0,y=0,label="Here is a line")
推荐答案
尝试使用geom_label
代替:
ggplot() +
geom_hline(yintercept = 0) +
labs(x = "", y = "") +
geom_label(aes(x = 0, y = 0, label = "Here is a line"), fill = "green")
这篇关于更改文本注释的背景颜色以增加对比度和可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文