arviz icon indicating copy to clipboard operation
arviz copied to clipboard

Add a backend that just returns plotting data

Open sethaxen opened this issue 5 years ago • 3 comments

The general pattern I'm seeing in most (all?) plotting functions is:

  1. Read inputs, process, make plot kwargs dict.
  2. Modify plot kwargs dict for the current backend
  3. Plot and optionally show using the backend

If the output of Step 1 was accessible, then users could pass the data to some other plotting package (of course with the heavy work of implementing the same plotting routine for that package).

This could be useful e.g. for ArviZ.jl, where one could then implement plotting functions for Plots.jl, which itself supports many backends, or Makie.jl, which supports interaction.

I see two main ways of doing it. First, one could have a backend like "data" that just returns the kwargs. Alternatively, the code to generate the kwargs could be refactored into its own function that the plotting function just wraps.

sethaxen avatar Mar 01 '20 09:03 sethaxen

It is doable. Our backend args are wild, really wild

ahartikainen avatar Mar 01 '20 11:03 ahartikainen

Yeah, from a brief survey, it doesn't look like a difficult refactor; but the implementation of the plotting logic for e.g. Plots.jl using those arguments is quite a daunting task, and I don't think I'll be able to devote the time to it just yet, so I'd call this low priority for now.

sethaxen avatar Mar 02 '20 06:03 sethaxen

https://github.com/arviz-devs/arviz-plots/pull/41 will add this to arviz-plots (which also as part of the refactoring has both matplotlib and bokeh as optional dependencies)

I am also adding the nofix label here to indicate no work on this issue will happen within this repo.

OriolAbril avatar Apr 11 '24 20:04 OriolAbril