for box in self._boxes: box._lw = float(value) return locals() @vv.misc.PropWithDraw def whiskers(): """ Get/Set the style of the whiskers. """ def fget(self): return self._boxes[0]._whiskers def fset(self, value): for box in self._boxes: box.SetWhiskers(value) return locals() if __name__ == '__main__': # Create data d1 = np.random.normal(1, 4, (1000, 1000)) d2 = np.random.normal(2, 3, (20, )) d3 = np.random.uniform(-1, 3, (100, )) d4 = [ 1, 2, 1, 2.0, 8, 2, 3, 1, 2, 2, 3, 2, 2.1, 8, 8, 8, 8, 8, 1.2, 1.3, 0, 0, 1.5, 2 ] # Show boxplot b = vv.boxplot((d1, d2, d3, d4), width=0.8, whiskers='violin')
vv.figure(1); vv.clf() # Show means in a normal bar chart a1 = vv.subplot(221); b2 = vv.bar(mean_temps_per_month) b2.color = 'r' # Show means in a 3D bar chart a2 = vv.subplot(222); b3 = vv.bar3(mean_temps_per_month) b3.color = 'g' a2.daspect = 1,1,0.3 # Show box plot a3 = vv.subplot(223) bp = vv.boxplot(temps_per_month) bp.lc = 'b' bp.lw = 2 # Show violin plot a4 = vv.subplot(224) vp = vv.boxplot(temps_per_month, whiskers='violin') vp.lc = 'm' vp.lw = 3 # Set legends and ticks for each axes for a in [a1, a2, a3, a4]: a.axis.xTicks = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split() if a is a2: a.axis.zLabel = 'Temperature [C^o]' a.axis.showGridZ = True
""" Get/Set the line width of the boxes. """ def fget(self): return self._boxes[0]._lw def fset(self, value): for box in self._boxes: box._lw = float(value) return locals() @vv.misc.PropWithDraw def whiskers(): """ Get/Set the style of the whiskers. """ def fget(self): return self._boxes[0]._whiskers def fset(self, value): for box in self._boxes: box.SetWhiskers(value) return locals() if __name__ == '__main__': # Create data d1 = np.random.normal(1, 4, (1000,1000)) d2 = np.random.normal(2, 3, (20,)) d3 = np.random.uniform(-1, 3, (100,)) d4 = [1,2,1,2.0, 8, 2, 3, 1, 2, 2, 3, 2, 2.1, 8, 8, 8, 8, 8, 1.2, 1.3, 0, 0, 1.5, 2] # Show boxplot b = vv.boxplot((d1,d2,d3, d4), width=0.8, whiskers='violin')
vv.clf() # Show means in a normal bar chart a1 = vv.subplot(221) b2 = vv.bar(mean_temps_per_month) b2.color = 'r' # Show means in a 3D bar chart a2 = vv.subplot(222) b3 = vv.bar3(mean_temps_per_month) b3.color = 'g' a2.daspect = 1, 1, 0.3 # Show box plot a3 = vv.subplot(223) bp = vv.boxplot(temps_per_month) bp.lc = 'b' bp.lw = 2 # Show violin plot a4 = vv.subplot(224) vp = vv.boxplot(temps_per_month, whiskers='violin') vp.lc = 'm' vp.lw = 3 # Set legends and ticks for each axes for a in [a1, a2, a3, a4]: a.axis.xTicks = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split() if a is a2: a.axis.zLabel = 'Temperature [C^o]' a.axis.showGridZ = True