public class Violin extends ChartObject{ //public variables //private variables private float yVal; private color m_color; //distributional information private TDistribution tdist; private float popSize; private double Sn; /****************************************** Getters ******************************************/ public color getColor(){ return m_color; }//end getColor public float getWidth(float y){ double yA = (Math.abs(y-yVal))/(Sn*(1.0)/sqrt(popSize)); float p = (float)tdist.density(yA); return map(p,0.0,(float)tdist.density(0),0,0.5); }//end getAlpha public float getMean(){ return yVal; } public String getLabel(){ if(m_label!=null){ return m_label; } else{ return ""; } } public float getStdDev(){ return (float)Sn; } /****************************************** Private Methods ******************************************/ private void calcMargin(float margin,int n){ tdist = new TDistribution((float)n-1); double A = tdist.inverseCumulativeProbability(0.975); Sn = margin*Math.sqrt(n)/A; }//end calcMargin /****************************************** Constructors ******************************************/ public Violin(float value,color barColor,float margin,int n){ yVal = value; m_color = barColor; popSize = n; calcMargin(margin,n); }//end Bar public Violin(float value,color barColor,float margin,int n,String label){ yVal = value; m_color = barColor; popSize = n; calcMargin(margin,n); m_label = label; x_tick = true; tickSize = DEFAULT_TICK_SIZE; }//end Bar /****************************************** Draw Method ******************************************/ public void draw(int curX,int barWidth,float startY,float endY,float dataMin,float dataMax){ float dataY; float h = startY-endY; noStroke(); for(int y=0;y