我们如何使用R创建Excel的色阶? [英] How can we create a color scales for excel using R?
本文介绍了我们如何使用R创建Excel的色阶?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想基于excel电子表格中的输入值创建一个色标.所需的输出是基于XLConnect中通过RIConnect进行编程但尚未找到的值在excel工作表中基于色标的单元格合适的解决方案.
I want to create a color scale based on the input values from an excel spreadsheet.The required output is a color scaled cells in the excel sheet based on the values which is programmed in R.I tried through XLConnect but haven't yet found a suitable solution.
感谢&问候
推荐答案
xlsx包允许将RGB颜色用于Fill().例如
The xlsx package allows using RGB-colors for Fill(). E.g.
fg <- rgb(100, 50, 50, max = 100)
bg <- "black"
style <- CellStyle(wb) + Fill(foregroundColor = fg, backgroundColor = bg)
setCellStyle(c, style)
设置rgb()的最大值可以更容易地根据值的范围缩放颜色.
Setting the max value for rgb() makes it easier to scale the color with respect to the value's range.
尽管如此,xlsx软件包还是有些恕我直言.
The xlsx package has some IMHO rough edges, though.
这篇关于我们如何使用R创建Excel的色阶?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文