bayesplot icon indicating copy to clipboard operation
bayesplot copied to clipboard

Make most plotting functions methods

Open jrnold opened this issue 7 years ago • 2 comments

I think it would help usability to make the various functions methods. I love that the functions are frontend agnostic and take arrays or data frames, but it would make it much more usable if the they were methods, so it would work directly with stanfit and stanreg objects.

I haven't looked too much at the code, but it looks like the internal function prepare_mcmc_array is doing most of what a method dispatcher would do. Maybe just exposing that function and making it a method would be sufficient.

jrnold avatar May 23 '17 18:05 jrnold

Thanks for the suggestions. More comments/questions below:

On Tue, May 23, 2017 at 2:44 PM, Jeffrey Arnold [email protected] wrote:

I haven't looked too much at the code, but it looks like the internal function prepare_mcmc_array is doing most of what a method dispatcher would do.

Yeah pretty much. It wouldn't be hard to convert it to S3 generic and methods.

Maybe just exposing that function and making it a method would be sufficient.

Do you mean that bayesplot would provide prepare_mcmc_array methods for stanfit and stanreg objects?

jgabry avatar May 24 '17 21:05 jgabry

Yes. If prepare_mcmc_array was made a generic function with methods for stanfit and stanreg objects, then it might be possible to avoid writing separate methods for each (or many) of the plotting functions.

jrnold avatar May 26 '17 06:05 jrnold