如何调整R中图例中各个标签之间的间距?

时间:2017-04-26 23:11:49

标签: r legend boxplot

我正在尝试调整图例中各个标签之间的空格,以便我可以看到所有9个标签但不幸的是我没有成功。这是我生成箱图

的代码
  # raw counts
  boxplot(log2(counts+1), col = col[as.integer(group)], las = 2,
        main = "Raw counts distribution", ylab = expression(log[2] ~ (raw ~ count + 1)))
  legend("top", levels(group), fill=col[1:nlevels(group)], horiz=TRUE)
  # norm counts
  boxplot(log2(norm.counts+1), col = col[as.integer(group)], las = 2,
        main = "Normalized counts distribution", ylab = expression(log[2] ~ (norm ~ count + 1)))
  legend("top", levels(group), fill=col[1:nlevels(group)], horiz=TRUE)

original boxplot

我甚至试图像这样包含text.width函数

    # raw counts
  boxplot(log2(counts+1), col = col[as.integer(group)], las = 2,
        main = "Raw counts distribution", ylab = expression(log[2] ~ (raw ~ count + 1)))
  legend("top", levels(group), fill=col[1:nlevels(group)], text.width = 0.2, horiz=TRUE)
  # norm counts
  boxplot(log2(norm.counts+1), col = col[as.integer(group)], las = 2,
        main = "Normalized counts distribution", ylab = expression(log[2] ~ (norm ~ count + 1)))
  legend("top", levels(group), fill=col[1:nlevels(group)], text.width = 0.2, horiz=TRUE)

但情况变得更糟。

modified boxplot

如何调整空格以查看所有标签?

0 个答案:

没有答案