I have a data frame trajectory_df that has the following structure:

The uid row has 6 different possible values, each representing a particular user. So I want to plot 6 lines on the same plot, and I'm currently doing it in this way:
ggplot(trajectory_df, aes(Month, Pagerank, colour=uid, group=uid)) + geom_line() + geom_point() + scale_x_discrete(breaks=month_ticks)
Which gives me this picture:

Which is just what I want, except for the legend. I want there to be 6 different entries in the legend, not a colorful range of values.
How can I accomplish this?
Try this instead:
ggplot(trajectory_df, aes(Month, Pagerank, colour=factor(uid), group=uid)) +
geom_line() +
geom_point() +
scale_x_discrete(breaks=month_ticks)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With