rCharts morris标题和轴标签

rCharts morris标题和轴标签,r,rcharts,morris.js,R,Rcharts,Morris.js,我试图通过rcharts说服morris显示图形标题和轴标签(x轴和y轴的名称)。没有成功。下面的例子 require(rCharts) tmp <- data.frame(a=c(1, 2, 3, 4, 5), b=c(0.1, 0.2, 0.3, 0.4, 0.5), c=c(0.2, 0.3, 0.4, 0.5, 0.6)) morrisPlot <- mPlot(x="a", y=c("b", "c")

我试图通过rcharts说服morris显示图形标题和轴标签(x轴和y轴的名称)。没有成功。下面的例子

require(rCharts)
tmp <- data.frame(a=c(1, 2, 3, 4, 5),
                  b=c(0.1, 0.2, 0.3, 0.4, 0.5),
                  c=c(0.2, 0.3, 0.4, 0.5, 0.6))

morrisPlot <- mPlot(x="a", y=c("b", "c"), data=tmp, 
                    type="Line", pointSize=4, parseTime=FALSE, hideHover="auto")
morrisPlot$set(height=500) # works
morrisPlot$set(width=500) # works
#morrisPlot$xAxis(axisLabel="a") # Error
#morrisPlot$yAxis(axisLabel="b") # Error
morrisPlot$set(title="Some Title") # doesn't show

morrisPlot
require(rCharts)

tmp这可能无法直接回答您的问题,但应该为您提供有关MorrisJS备选方案的指导

require(rCharts)
tmp <- data.frame(
  a = c(1, 2, 3, 4, 5),
  b = c(0.1, 0.2, 0.3, 0.4, 0.5),
  c = c(0.2, 0.3, 0.4, 0.5, 0.6)
)

options(stringsAsFactors = F)
library(reshape2)
tmp_m = melt(tmp, id = "a")
library(rCharts)
# NVD3
nPlot(value ~ a, group = 'variable', data = tmp_m, type = 'lineChart')

# Polychart
rPlot(value ~ a, color = 'variable', data = tmp_m, type = 'line')

# Highcharts
hPlot(value ~ a, group = 'variable', data = tmp_m, type = 'line')
require(rCharts)

tmp上一次我检查MorrisJS库时,它至少开始支持
y轴
标签,也许还支持
x轴
标签,正如@ScottChamberlain所指出的,对于这里的某些上下文,我不认为pull请求对Morris的稳定版本产生了影响,此时我将更新绑定。请注意,您可以随时将数据融化,以便与其他库一起使用。莫里斯图表是否需要自定义?其他哪些图表最容易自定义<代码>nPlot
rPlot
,或
hPlot
?谢谢