Skip to content

Instantly share code, notes, and snippets.

@raphifix
Last active February 2, 2016 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raphifix/847f73e8cc7d6a7da9a3 to your computer and use it in GitHub Desktop.
Save raphifix/847f73e8cc7d6a7da9a3 to your computer and use it in GitHub Desktop.
line_list <- list()
for(i in 1:nrow(line_dat)){
line_color <- ifelse(line_dat$signal[i] == 'buy', 'green', 'red')
line_list[[i]] <- list(type = "line",
fillcolor = line_color, line = list(color = line_color), opacity = 0.3,
x0 = line_dat[[1]][i], x1 = line_dat[[1]][i], xref = "x",
y0 = 0, y1 = line_dat[[2]][i], yref = "y")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment