r - 在 nPlot 中为 discreteBarChart 更改颜色

标签 r rcharts

我正在尝试使用 nPlot 更改 discreteBarChart 的条形颜色,但在下面的示例中颜色参数似乎没有任何改变:

data(cars) 
speedTableVec<-table(cars$speed) 
speedTable<-data.frame(speedTableVec)
n1<-nPlot(Freq ~ Var1, data=speedTable, type="discreteBarChart", color="blue")
n1

有没有办法让条形始终保持一种颜色(即蓝色)?谢谢。

最佳答案

这是一个解决方案。我假设您正在寻找使用 NVD3nPlot。参见 here最终图表。

data(cars) 
speedTableVec<-table(cars$speed) 
speedTable<-data.frame(speedTableVec)
require(rCharts)
n1 <- nPlot(Freq ~ Var1, data = speedTable, type="discreteBarChart")
n1$chart(color = "#! function(d){ return 'blue'} !#")

希望这对您有所帮助。

关于r - 在 nPlot 中为 discreteBarChart 更改颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19237255/

相关文章:

rCharts 轴标签与刻度线标签重叠

r - 使用 rCharts 在 r 和shiny中创建传单热图

rCharts-如何向 NVD3 图表添加轴标签和标题

R:将行 reshape 为列并用 NA 填充

rvest,如何在 html_nodes 中使用 NA 值来创建数据表

r - 如何创建一个对角矩阵,对角线上有 block ,每个 block 有一个不同的矩阵?

r - 组合多个神经网络模型

r - 使用R中的lubridate包查找一年中的某天

r - 从 rCharts 保存到图像文件

rMaps ichoropleth 与自定义 map /shp