How to use plot_trace to draw individuals results in dependet piture?

Ok, I’m with you now. Part of my confusion was I thought pm.traceplot was just a wrapper around az.plot_trace, but they seem to be operating differently here.

I think the cleanest way to do this might be to pull the samples from each subject out and use plot_trace on that, e.g.

subject_idx = 1
subject = []
for sample in trace['G']:
    trials = [x[subject_idx] for x in sample]
    subject.append(trials)

az.plot_trace(np.array(subject))

Unfortunately matplotlib axes are tightly coupled to the figure, and I couldn’t find a way to take them from the figure and plot them individually. You could try something like resizing them, but I couldn’t get that to work

1 Like