Reputation: 311
I want to use a different color scheme for my bar graph using the plotly library, its code is looking like this right now:
library(plotly)
p <- plot_ly(
x=c("1","2", "3", "4", "5", "6", "7", "8", "9"),
y=c(0.79, 0.57, 0.57, 0.59, 0.46, 0.38, 0.33, 0.57),
name = "2007",
type = "bar"
)
p
p2 <- add_trace(
p,
x=c("1","2", "3", "4", "5", "6", "7", "8", "9"),
y=c(0.79, 0.57, 0.57, 0.59, 0.46, 0.38, 0.25, 0.58),
name = "2008",
type = "bar")
p2
Upvotes: 2
Views: 1283
Reputation: 9876
Do you mean something like this:
p <- plot_ly(
x=c("1","2", "3", "4", "5", "6", "7", "8", "9"),
y=c(0.79, 0.57, 0.57, 0.59, 0.46, 0.38, 0.33, 0.57),
name = "2007",
type = "bar", marker = list(color = toRGB("yellow"))
)
p
p2 <- add_trace(
p,
x=c("1","2", "3", "4", "5", "6", "7", "8", "9"),
y=c(0.79, 0.57, 0.57, 0.59, 0.46, 0.38, 0.25, 0.58),
name = "2008",
type = "bar", marker = list(color = toRGB("black")))
p2
Upvotes: 4