【问题标题】:Adjusting Legend Shiny R调整 Legend Shiny R
【发布时间】:2018-06-21 13:43:06
【问题描述】:

我正在尝试摆脱如下所示的空白空白,但似乎无法弄清楚如何做到这一点。

示例代码:

 legend("bottom", 
         colnames(bvoip.collab.seats)[3:4],
         xpd = FALSE,
         horiz = TRUE, 
         #ncol = 1 , 
         inset = c(0, 0),
         bty = "o",
         bg = "gray90", 
         box.col="gray90",
         pch = c(15, 15, 15, 15, 15), 
         col = c(attDarkBlue,attOrange,attGreen), 
         legend = c(" Collaborate-Enhanced Mobile"," Collaborate"," Collaborate-Internal"),
         pt.cex = 1.3,cex = 0.8,yjust = 0.5)

【问题讨论】:

  • 您可以尝试调整text.width 和/或x.intersp?
  • 您是否也接受ggplot2 的回答?如果没有,this answer 可能会很有趣。

标签: r shiny legend


【解决方案1】:

这是一个变通方法,但是在 Legend() 中使用“text.width”属性可以完成工作。它并不完美,但它会做到。

text.width=c(.5,.2,.5),

完整代码

legend("bottom", 
         colnames(bvoip.collab.seats)[3:4],
         xpd = FALSE,
         horiz = TRUE, 
         text.width=c(.5,.2,.5),
         #ncol = 1 , 
         inset = c(0, 0),
         bty = "o",
         bg = "gray90", 
         box.col="gray90",
         pch = c(15, 15, 15, 15, 15), 
         col = c(attDarkBlue,attOrange,attGreen), 
         legend = c(" Collaborate-Enhanced Mobile", " Collaborate", " Collaborate-Internal"),
         pt.cex = 1.3,cex = 0.8,yjust = 0.5)

【讨论】:

    猜你喜欢
    • 2020-08-08
    • 2015-06-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-18
    相关资源
    最近更新 更多