Forum Discussion

vijaybansal3000's avatar
vijaybansal3000
Frequent Visitor
9 years ago
Solved

line chart - color gradient

I am trying to look at variation of ridership values with month. I have plotted data for 10 years but all the lines appear in different colors which makes it little difficult to understand unless you...
  • Anonymous's avatar
    Anonymous
    9 years ago

    You could do it in R, though you lose interactivity back into your dataset etc.  Something like:

     

    library(ggplot2)    # Needed for ggplot
    # Avoid having to reference dataset$ each time in function calls
    attach(dataset)
    
    #Plot the Count dataset by Month and Year, with Year to set the fill colour
    ggplot(dataset, aes(x=Month, y=Count, group=Year, colour=Year)) +
    #Use lines on the plot
      geom_line() +
    Restrict the colur hue to (around) the green range
      scale_color_hue(h=c(90,180))

     You may need to fiddle with the scale_colour_hue parameters to get exactly what you want.