这是我的数据
new <- structure(list(Var1 = structure(c(1L, 5L, 4L, 6L, 2L, 3L, 1L,
5L, 4L, 6L, 2L, 3L, 1L, 5L, 4L, 6L, 2L, 3L, 1L, 5L, 4L, 6L, 2L,
3L, 1L, 5L, 4L, 6L, 2L, 3L, 1L, 5L, 4L, 6L, 2L, 3L, 1L, 5L, 4L,
6L, 2L, 3L, 1L, 5L, 4L, 6L, 2L, 3L, 1L, 5L, 4L, 6L, 2L, 3L, 1L,
5L, 4L, 6L, 2L, 3L), .Label = c("Month of 2013-07", "Month of 2013-08",
"Month of 2013-09", "Month of 2013-10", "Month of 2013-11", "Month of 2013-12"
), class = "factor"), Var2 = structure(c(1L, 1L, 1L, 1L, 1L,
1L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L,
5L, 5L, 5L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 8L,
8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L,
10L, 10L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("Group 1", "Group 10",
"Group 2", "Group 3", "Group 4", "Group 5", "Group 6", "Group 7",
"Group 8", "Group 9"), class = "factor"), value = c(1, 0.073,
0.106, 0.056, 0.036, 0.007, 0, 1, 0.006, 0.022, 0.005, 0.038,
0, 0.867, 1, 0.052, 0, 0.147, 0, 0.005, 0.007, 1, 0.005, 0.003,
0, 1, 0.474, 0.017, 0, 0.039, 0.026, 0.001, 0.008, 0, 1, 0.01,
0.004, 0, 0.074, 0.001, 0.003, 1, 0, 0.006, 1, 0.003, 0.012,
0.011, 0, 0.911, 1, 0.352, 0, 0.27, 0, 0.349, 0.016, 0.101, 1,
0.845)), .Names = c("Var1", "Var2", "value"), row.names = c(NA,
-60L), class = "data.frame")
(这是图表的可重复数据)
生成图表的代码:
require(rCharts)
inteplot.7 <- rPlot(Var1 ~ Var2, color = 'value', data = new ,type = 'tile')
inteplot.7$guides("{color: {scale: {type: gradient, lower: white, upper: steelblue}}}")
inteplot.7$guides(x = list(levels = c('Group 1', 'Group 2', 'Group 3', 'Group 4', 'Group 5',
'Group 6', 'Group 7', 'Group 8', 'Group 9', 'Group 10')))
inteplot.7
知道为什么它没有在浏览器中显示?
(已编辑)我正在使用Chrome。在IE中工作。任何使其适用于Chrome的解决方案? (编辑2)我的降价选项
```{r results = 'asis', comment = NA, cache = T,echo=F,fig.height=550,out.height=550,fig.width=1000,out.width=1000,message=FALSE,warning=FALSE}
options(rcharts.mode = 'iframe', rcharts.cdn = TRUE)
op <- options(gvis.plot.tag='chart')
inteplot.7$show('iframesrc', cdn = T,static = FALSE)
```
答案 0 :(得分:3)
我也遇到了你描述的问题。我找到了以下解决方法,它也提供了我认为更好的工作流程。
r
块中的单独html文件(而不是尝试显示它&#39;内联&#39;)<iframe>
我认为这是更好的工作流程,因为您可以保存所有文档&#39;如果需要,可以使用有意义名称的图表并将它们放在其他文档中。如果你的系统从现在开始几个月没有编译,并且截止日期即将到来,那么你可以使用独立的html。
示例:
```{r 'Figure_1_1', results = 'asis', comment = NA, cache = FALSE, fig.height = 5, fig.width = 8}
require(rCharts)
load("data/df_1_1.Rda")
# round data for rChart tooltip display
df_1_1$value <- round(df_1_1$value, 2)
n <- nPlot(value ~ Year, group = 'variable', data = df_1_1, type = 'lineChart')
n$save('figures/Figure_1_1.html', standalone = TRUE)
```
<iframe src ='figures/Figure_1_1.html', width = "860px", height = "450px"></iframe>
请注意我是如何使用r chunk的fig.height
和fig.width
(以英寸为单位)和html iframe&#39; width
和{{ 1}}(以像素为单位),以实现高分辨率和适合网页尺寸。我不确定height
和fig.height
对rChart做了什么(如果有的话),但如果您的文档中有其他类型的图表,例如fig.height
图,那么你可能想要在ggplot2
和r
块中设置图形尺寸。
如果与html
发生冲突(正如我在fig.retina
块中设置out.width
所做的那样),则在r chunk中将其设置为NULL:{{ 1}}
答案 1 :(得分:1)
试试这个
r1 <- rPlot(Var1 ~ Var2, color = 'value', data = new ,type = 'tile')
r1$guides("{color: {scale: {type: gradient, lower: white, upper: steelblue}}}")
r1$guides(x = list(numticks = 10))
r1
代码的问题是您指定级别的最后一行。
答案 2 :(得分:0)
您的因子级别名称中的空格似乎是个问题。删除所有空格可以解决问题:
for (int i = 1; i < count; i++ ) {
...
View[] myView = new View[i];
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
myView[i-1] = inflater.inflate(R.layout.profile_list, null);