Home > Blockchain >  Manually applying different colors in R ggplot
Manually applying different colors in R ggplot

Time:06-23

ggplot(data = s2[1:39,], aes(x=Month, y=Users, group=Year, col=Year)) geom_line(size=1.3) geom_point(size=4.5) geom_point(size=4.0, color='#FFFFFF') ggtitle("Seoul_year") scale_x_continuous(breaks=c(1,2,3,4,5,6,7,8,9,10,11,12)) scale_y_continuous(labels = scales::comma)

ggplot result

From the upper code I keep getting same blueish colors(per year) in plotting line graph in R. However, I want to apply different color of lines in the graph. Which code line should I fix?

enter image description here

CodePudding user response:

try

scale_color_gradient(low="red",high="black")

while red or black can be whatever, including HEX code. It still means your Year variable is numeric though.

  • Related