anesthetic
anesthetic copied to clipboard
Fix to pandas calls of kde_1d
At the moment this code does not work correctly
samples = Samples(...)
samples.plot.kde_1d(subplots=True)
This should produce a pandas-style array of kde_1d plots, but at the moment only produces the first one due to a hard-coded 0 in self.data.values[:,0]
in anesthetic.plotting._matplotlib.hist.Kde1dPlot._make_plot
. This is not a particularly harmful bug, as it would be quite a rare use-case to use our custom anesthetic kde_1d
for plotting arrays outside of plot_1d
(indeed it's an option to make these synonyms at some point).
This issue flags this bug.
I've stumbled into this from the context of passing a color
argument to a kde_1d plot, e.g.
samps = anesthetic.read_chains("my_chains")
samps.paramname.plot.kde_1d(color="mycolor")
The Pandas MPLPlot constructor stores this in a list ["mycolor"]
, which leads to anesthetic.plot.kde_plot_1d
complaining that ["mycolor"]
is not a valid value for color.
How about we separate out the parts of kde_plot_1d()
which calculate the x and y values, and give these to MPLPlot._plot() to deal with all the formatting, so that Kde1dPlot is analogous to KdePlot?
Is this fixed by #235?
Yes. There's just some an?esthetic issues I wanted to discuss, then should be ready to go.
I think this is fixed, right? Or is there something remaining to this issue?
I think this was fixed during the adventures of #235