Reputation: 4370
I'm trying to plot a small multiples graph of sparklines such that the background of each sparkline is coloured according to a variable (var4). I can do this with ggplot in R, but it's not converting well to Plotly.
ggplot(data, aes(x=var1, y=var2, group=var3, text=var3)) +
geom_rect(data = data, aes(xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf, fill = var4), alpha = 0.4) +
geom_line() +
scale_fill_gradient2(low = "red", mid = "white", high = "red", midpoint = 0, space = "rgb", na.value = "grey50", guide = "colourbar") +
facet_wrap(~ var3, ncol = 44, scales = "fixed")
I've thought about maybe doing a "histogram" in Plotly, overlaid with my sparklines, but I can't quite figure that out either.
Any thoughts are appreciated.
Upvotes: 0
Views: 719