In ggplot2 there is a conceptual relationship between geoms and stats. With
this relationship comes the largely distinct responsibilities of geoms
and stats. In short, stats transform the data and geoms plot/visualize/render
the data.
Since a ggplot object must be "plottable" if it has at least one geom or stat
added to it, then each stat should have a default geom responsible for the
plotting. Likewise, the geoms use stats to make transformations if required.
As a result each geom has a default stat and each stat has a default
geom, with stat='identity' if the no data transformation is done before the
plotting.
To maintain the conceptual integrity, all stats delegate the plotting to the
geoms. The benefit of this discipline in implementation is that any
stat that takes less parameters can be applied to a geom provided that
the stat after transformations can meet the requirements of the geom.
Direction towards this objective:
allow for a stat argument for the geoms and a geom argument to the stats.
refactor computations/transformations from the geoms to the stats.
refactor plotting from the stats to the geoms.
I am working on part of #175 where the 1st point should be taken care of.
Given @JanSchulz's pending combined refactoring (#160 & #221) in PR #235, I
lack a clearer picture on the 2nd and 3rd points and it seems prudent to wait and see how
it (#235) shapes up.
In ggplot2 there is a conceptual relationship between
geoms
andstats
. With this relationship comes the largely distinct responsibilities ofgeoms
andstats
. In short,stats
transform the data andgeoms
plot/visualize/render the data.Since a
ggplot
object must be "plottable" if it has at least onegeom
orstat
added to it, then eachstat
should have a defaultgeom
responsible for the plotting. Likewise, thegeoms
usestats
to make transformations if required.As a result each
geom
has a defaultstat
and eachstat
has a defaultgeom
, withstat='identity'
if the no data transformation is done before the plotting.To maintain the conceptual integrity, all
stats
delegate the plotting to thegeoms
. The benefit of this discipline in implementation is that anystat
that takes less parameters can be applied to ageom
provided that thestat
after transformations can meet the requirements of thegeom
.Direction towards this objective:
stat
argument for thegeoms
and ageom
argument to thestats
.geoms
to thestats
.stats
to thegeoms
.I am working on part of #175 where the 1st point should be taken care of. Given @JanSchulz's pending combined refactoring (#160 & #221) in PR #235, I lack a clearer picture on the 2nd and 3rd points and it seems prudent to wait and see how it (#235) shapes up.
Suggestions?