여러 경로가 여러 세그먼트 있습니다. 각 경로의 N 번째 세그먼트를 같은 색으로 어떻게 색칠합니까?색상 경로 세그먼트 in ggvis/layer_paths
예를 들어:
require(dplyr)
require(ggvis)
df <- data.frame(x = runif(10,0,10), y = runif(10,0,10),
group=c(rep(5,5),rep(10,5)), colorIdx=rep(c(1:5), 2))
df$group = factor(df$group)
color_fun = colorRampPalette(c("yellow","blue"),5)
myColors = color_fun(5)
df$color = myColors[df$colorIdx]
df %>% group_by(group) %>%
ggvis(~x, ~y, strokeWidth:=~group) %>% layer_paths(stroke :=~color)
결과 경로는 단색입니다 - 내가 그들을 파란색 노란색에서 확장하고 싶습니다.
require(ggplot2)
ggplot(df, aes(x=x, y=y, group=group, colour=colorIdx, size=group)) + geom_path() +
scale_colour_gradient("", low="#FED863", high="#2A6EBB", limits=c(1,4))
그것은 보이는 - https://github.com/trifacta/vega/issues/122 – jalapic