【问题标题】:Draw label as a rectangle with edges rather than with rounded corners将标签绘制为带有边缘而不是圆角的矩形
【发布时间】:2022-01-21 04:10:21
【问题描述】:

在ggplot2中使用geom_label(),是否可以使矩形完全正方形而不是圆角?

data(iris)

ggplot(iris, aes(Sepal.Width, Sepal.Length)) + geom_point() + 
geom_label(x=4, y=7, label = "Test label")

我想把测试标签周围的圆角矩形弄平。

谢谢。

【问题讨论】:

    标签: r ggplot2 label


    【解决方案1】:

    是的,您可以将 label.r 参数设置为 0。

    library(ggplot2)
    
    ggplot(iris, aes(Sepal.Width, Sepal.Length)) + geom_point() +
      geom_label(x=4, y=7, label = "Test label",
                 label.r = unit(0, "pt"))
    

    reprex package (v2.0.1) 于 2021 年 12 月 18 日创建

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-02
    • 1970-01-01
    相关资源
    最近更新 更多