Open n8thangreen opened 3 years ago
i.e. all the plot types (ceac, ceplane, ib, eib, ...
) have the same methods (make_plot_params, make_plot_data, plot_base, plot_ggplot
)
multiple inheritence? base class?
not doing something like double-dispatch since there are only 3 types of plot and I don't imagine there will be any need to extend it in the future => over-engineered, premature generalisation leads to bloated software.
this will force me to make all of the bcea_plot()
functions the same for all plots. At the moment they are certainly very similar but have some differences, especially in terms of input arguments. This could be a a good exercise if its not too much trouble..
use factory-type pattern instead?
structure()
.new_plottype(he, "ceac")
then can reuse in other plot types because pattern the same e. g. create function
ceac.plot <- .new_plot("ceac")
because ceac.plot()
, ceplane.plot()
etc are duplicated too.
Then
.new_plot <- function(plottype) {
function (he, graph, ...) {
he <- .new_plottype(he, plottype)
.bcea_plot(he, graph, ...)
}
}
Can we do a function factory which defines arguments like ...
?
args_names <- default_args[[plottype]]
dot_list <- keep(list(...), args_names)
could have:
etc