barchart.py (2117:cd2f6cff36df) | barchart.py (2118:1fe7d0ddf765) |
---|---|
1# Copyright (c) 2005-2006 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 62 unchanged lines hidden (view full) --- 71 if dim == 1: 72 self.chartdata = array([[data]]) 73 74 # If the input data is a 2d matrix, then it describes a bar 75 # chart with groups. The matrix being an array of groups of 76 # bars. 77 if dim == 2: 78 self.chartdata = transpose([data], axes=(2,0,1)) | 1# Copyright (c) 2005-2006 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 62 unchanged lines hidden (view full) --- 71 if dim == 1: 72 self.chartdata = array([[data]]) 73 74 # If the input data is a 2d matrix, then it describes a bar 75 # chart with groups. The matrix being an array of groups of 76 # bars. 77 if dim == 2: 78 self.chartdata = transpose([data], axes=(2,0,1)) |
79 print shape(self.chartdata) | |
80 81 # If the input data is a 3d matrix, then it describes an array 82 # of groups of bars with each bar being an array of stacked 83 # values. 84 if dim == 3: 85 self.chartdata = transpose(data, axes=(1,2,0)) | 79 80 # If the input data is a 3d matrix, then it describes an array 81 # of groups of bars with each bar being an array of stacked 82 # values. 83 if dim == 3: 84 self.chartdata = transpose(data, axes=(1,2,0)) |
86 print shape(self.chartdata) | |
87 88 def get_data(self): 89 return self.inputdata 90 91 data = property(get_data, set_data) 92 93 # Graph the chart data. 94 # Input is a 3d matrix that describes a plot that has multiple --- 107 unchanged lines hidden (view full) --- 202 self.inner_axes.set_ylim(self.ylim) 203 204 if self.xticks is not None: 205 outer_axes.set_xticks(arange(cshape[2]) + .5) 206 outer_axes.set_xticklabels(self.xticks) 207 if self.xsubticks is not None: 208 inner_axes.set_xticks(arange((cshape[0] + 1)*cshape[2])*width + 2*center) 209 self.xsubticks.append('') | 85 86 def get_data(self): 87 return self.inputdata 88 89 data = property(get_data, set_data) 90 91 # Graph the chart data. 92 # Input is a 3d matrix that describes a plot that has multiple --- 107 unchanged lines hidden (view full) --- 200 self.inner_axes.set_ylim(self.ylim) 201 202 if self.xticks is not None: 203 outer_axes.set_xticks(arange(cshape[2]) + .5) 204 outer_axes.set_xticklabels(self.xticks) 205 if self.xsubticks is not None: 206 inner_axes.set_xticks(arange((cshape[0] + 1)*cshape[2])*width + 2*center) 207 self.xsubticks.append('') |
210 inner_axes.set_xticklabels(self.xsubticks * cshape[0], fontsize=8) | 208 inner_axes.set_xticklabels(self.xsubticks * cshape[2], fontsize=8) |
211 if self.legend is not None: 212 if dim == 1: 213 lbars = bars[0][0] 214 if dim == 2: 215 lbars = [ bars[i][0][0] for i in xrange(len(bars))] 216 if dim == 3: 217 number = len(bars[0]) 218 lbars = [ bars[0][number - j - 1][0] for j in xrange(number)] --- 82 unchanged lines hidden --- | 209 if self.legend is not None: 210 if dim == 1: 211 lbars = bars[0][0] 212 if dim == 2: 213 lbars = [ bars[i][0][0] for i in xrange(len(bars))] 214 if dim == 3: 215 number = len(bars[0]) 216 lbars = [ bars[0][number - j - 1][0] for j in xrange(number)] --- 82 unchanged lines hidden --- |