I am trying to plot two lines with their respective legend on ggplot2 but have been unsuccessful so far. I've tried distinguishing them by line type on the geom_line field but the graph fails to plot. What could be the cause?
Example data:
x <-
year counts amounts
2000 0 2
2001 1 2
2002 1 0
2003 0 1
2004 3 7
2005 1 11
2006 2 10
2007 2 12
2008 3 13
2009 3 15
2010 3 17
ggplot(x, aes(x = year)) +
geom_line(aes(y = counts)) +
geom_line(aes(y = amounts)) +
theme_bw()
Thanks for the help!