user5596792
user5596792

Reputation: 67

How can I change the color of my line graph in R?

There seems to be an issue for me to specify the color. When I do color by rowid it gives me a default blue color that is shades of the same color that I don't know how to change. I want each line to have a unique color. How can I do so?

plot <- ggplot(data=viewership, aes(x=variable, y=value, group=rowid)) + 
          geom_line(aes(colour=rowid, group=rowid)) + 
          geom_point() 

Upvotes: 0

Views: 274

Answers (1)

TheRimalaya
TheRimalaya

Reputation: 4592

Change rowid into factor,

viewership$rowid <- as.factor(viewership$rowid)

Re-run your code, you will get your plot.

Upvotes: 1

Related Questions