【问题标题】:How to define next line in a list for label如何在标签列表中定义下一行
【发布时间】:2010-08-31 01:05:50
【问题描述】:

我负责在工作中自动生成图表,需要一种特定的方式在我们的条形图上显示比例。目前我们拥有的是 i.imgur.com/bWjk9.png

他们想要下面列出的每个比例的值。当我改变比例时,它会变成这样。

i.imgur.com/1D9up.png

而他们想要的方式就像不知道 (9) 的显示方式

这是我使用 barplot2 在别处查找比例的图表代码

plot.graph <- function(data, px, py, scale_lab){
  par(mar=c(5.1, 4, 1, 2))
  #Plotting the Barplot
 barplot2(summary(data),
  #main = strwrap(heading, width = 50),
  xlab = "Response",
  ylab = "Number of Responses",
  prcol = "#FAF4E6",
  col = "#800000",
  space = 1.5,
  ylim = c(0, max(summary(data))+2),
  names.arg = sapply(scale_lab,wordwrap,USE.NAMES=TRUE),

  plot.grid = TRUE)
 points(px, py, pch=21, cex=4, col="black", bg="yellow", lwd=1)
 par(mar=c(5, 4, 4, 2) + 0.1)
 }

任何帮助将不胜感激。

卡梅隆。

【问题讨论】:

  • 什么是wordwrap函数?它似乎对标签负责。
  • 基本上是为了避免标签相互碰撞。 wordwrap

标签: r


【解决方案1】:

我自己想出来的,

对于那些感兴趣的人来说,所需要的只是

mtext(text= c("(1)", "(2)", "(3)", "(4)", "(5)", "(9)"),side = 1, line = 2, outer = FALSE, at = c(2, 4.5, 7, 9.5, 12, 14.5))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-05-21
    • 2014-02-22
    • 2012-08-11
    • 2020-08-23
    • 1970-01-01
    • 1970-01-01
    • 2013-03-28
    • 2021-03-29
    相关资源
    最近更新 更多