Unfortunately I can no longer find the bluesky post that pointed this out, but:
(ggplot(mpg, aes(x="displ", y="hwy", colour="class"))
+ geom_point()
+ geom_smooth(method="lm")
+ facet_wrap("drv")
+ theme_minimal()
+ labs(title="Engine Displacement vs Highway MPG"))
Is not much better than
sum(
ggplot(mpg, aes(x="displ", y="hwy", colour="class")),
geom_point(),
geom_smooth(method="lm"),
facet_wrap("drv"),
theme_minimal(),
labs(title="Engine Displacement vs Highway MPG"),
)
So it might be worth considering if overloading + is even worth it.
You can see a bit of historical context at https://github.com/hadley/ggplot1 — ggplot2 only used the plus because I couldn't see a better way to do function composition.
Unfortunately I can no longer find the bluesky post that pointed this out, but:
Is not much better than
So it might be worth considering if overloading
+is even worth it.You can see a bit of historical context at https://github.com/hadley/ggplot1 — ggplot2 only used the plus because I couldn't see a better way to do function composition.