Open TimothyWillard opened 6 days ago
Interesting, I would trust you on what's best but I believe there are some arguments for having the plot function as one function for each object.
One of them is that it is core to the object functionnality, as much as it's possibility to be printed and exported. We want to be able to plot both the internal representation (the closest to what the rk4 integrator is getting) and the external representation (the exported dataframe). It's the same with the DataFrame.plot methods in pandas, or the xarray.plot method. These are very convienient while working with these librairies
While it would be important to improve these functions (return axes, take axes as potential arguements, ...), the code to plot each object is very much addhoc to the object internal (even external) representation that I don't see it working well outside of that object remit.
from gempyor import compartments
cp = compartments.Compartments(config_snippet)
cp.plot_graph(filters={"age":"age0to17"})
vs
from gempyor import compartments, viz
viz.plot_comparments_graph(cp, filters={"age":"age0to17"})
Label
gempyor
Priority Label
low priority
Is your feature request related to a problem? Please describe.
Currently the function to plot compartments is attached to the
Compartments
class ingempyor.compartments
. Which bloats the object and isn't core to its logic of parsing and handling compartments/transitions. Lightly related to GH-345.Is your feature request related to a new application, scenario round, pathogen? Please describe.
n/a
Describe the solution you'd like
Create a new function, called
plot_compartments
or similar, that is separate from theCompartments
class and takes a an instance of theCompartments
class. In the future this could be split out into a separate package if desired, but currently should be put into a new module ingempyor
calledviz
or similar. Could also allow us to move thegraphviz
dependency into a separate dependency group.