I'm working on a homework assignment for the Coursera Exploratory Data Analysis class, and this code creates the following image:
qplot(year, Emissions, data=Baltimore_Data,
stat='summary', fun.y='sum', facets=.~type)
I am trying to connect the dots, and I've been trying things like:
+ geom_line()
and
+ geom_polygon()
and lots of other things to no avail. For what it's worth, I already met the intent without the lines, I just wanted to make it prettier and it bothers me that I can't figure it out!
You need to aggregate outside of ggplot or use stat_summary
twice (which is somewhat wasteful for bigger datasets):
ggplot(Baltimore_Data, aes(x = year, y= Emissions)) +
stat_summary(fun.y = sum, geom = "point") +
stat_summary(fun.y = sum, geom = "line") +
facet_grid(. ~ type)
(Not tested because there is no reproducible example in the question.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.