在R中创建温度计图表

时间:2015-05-16 07:34:48

标签: r

您好我正在尝试在R中创建温度计图。我找不到温度计图的任何示例。有人能告诉我这是如何在R中实现的吗?

此图表将用于显示活动期间筹集的资金金额。一个例子将受到高度赞赏。

1 个答案:

答案 0 :(得分:4)

查看?symbols

# fundraising objective
z <- 1000
# amount gathered
y <- 600 

symbols(1, thermometers = cbind(.5, 1, y/z), fg = 2, 
        xlab = NA, ylab = NA, axes = F, main = "Fundraising event")
text(1, paste0(y, "$", " / ", z, "$"), pos = 2, offset = 3)
text(1, paste0(y/z*100, "%"), pos = 1, offset = 3)

enter image description here