I\'m plotting a series of financial projections with ggplot\'s geom_path().
ggplot(df,aes(year,pot,color=iRate)) + geom_path() + theme(legend.position=\"none\"
Thanks @aosmith for mentioning the argument group
in your comment. Here is a reproducible example describing the path closing issue with the airquality dataset. Let's say you want to plot a chart of temperature along the days of each month. Keeping all months on the same plot (in the spirit of these yearly plots: arcticseaicenews).
Using geom_path()
alone leads to annoying "closing" lines between the last day of the previous month and the first day of the next month.
library(ggplot2)
ggplot(airquality, aes(x = Day, y = Temp)) +
geom_path()
Using geom_path()
with the argument group=Month
prevents these lines from appearing:
ggplot(airquality, aes(x = Day, y = Temp, group=Month)) +
geom_path()
Of course you could also display months on different facets with facet_wrap
depending on what you desire:
ggplot(airquality, aes(x = Day, y = Temp)) +
geom_path() +
facet_wrap(~Month)