beast-dev / tracer

Posterior summarisation in Bayesian phylogenetics
https://beast.community/tracer
GNU Lesser General Public License v2.1
55 stars 17 forks source link

ViolinPlot cannot handle trace having less than 3 values #133

Closed walterxie closed 6 years ago

walterxie commented 6 years ago

@rambaut ViolinPlot cannot handle trace having less than 3 values, which mostly happens for non-real type, such as host.indicators in the example log (only has 0, 1).

To replicate, load batRABV.log, and select any 2 host.indicators together, then get a strange triangle. But ViolinPlot works for 3 and more than 3 values.

screen shot 2018-01-30 at 3 33 51 pm
walterxie commented 6 years ago

change to interval plot for value < 3?

walterxie commented 6 years ago

@rambaut I updated IntervalsPanel.setupTraces() after line 197 for discrete trace. ViolinPlot works fine when there are more than 2 values in the trace. But when <= 2, hpd lower and upper will not be calculated properly, and then ViolinPlot will make a funny plot. To solve this problem, I use the min and max for 2 values or the mean for 1 value, and also change to IntegerViolinPlot. It looks good now.

screen shot 2018-01-31 at 12 19 13 pm
rambaut commented 6 years ago

Interesting. Not the most obvious visualization for binary traces but will do for now. Possibly better to use stacked bars?