barchart.py (2180:44599b79ef80) barchart.py (2182:cd8095e0f475)
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

--- 163 unchanged lines hidden (view full) ---

172 colors = array(colors)
173
174 self.figure = pylab.figure(figsize=self.chart_size)
175
176 outer_axes = None
177 inner_axes = None
178 if self.xsubticks is not None:
179 color = self.figure.get_facecolor()
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

--- 163 unchanged lines hidden (view full) ---

172 colors = array(colors)
173
174 self.figure = pylab.figure(figsize=self.chart_size)
175
176 outer_axes = None
177 inner_axes = None
178 if self.xsubticks is not None:
179 color = self.figure.get_facecolor()
180 self.metaaxes = self.figure.add_axes(self.figure_size, axisbg=color, frameon=False)
180 self.metaaxes = self.figure.add_axes(self.figure_size,
181 axisbg=color, frameon=False)
181 for tick in self.metaaxes.xaxis.majorTicks:
182 tick.tick1On = False
183 tick.tick2On = False
184 self.metaaxes.set_yticklabels([])
185 self.metaaxes.set_yticks([])
186 size = [0] * 4
187 size[0] = self.figure_size[0]
188 size[1] = self.figure_size[1] + .12

--- 45 unchanged lines hidden (view full) ---

234 elif self.ylim is not None:
235 self.inner_axes.set_ylim(self.ylim)
236
237 if self.xticks is not None:
238 outer_axes.set_xticks(arange(cshape[2]) + .5)
239 outer_axes.set_xticklabels(self.xticks)
240
241 if self.xsubticks is not None:
182 for tick in self.metaaxes.xaxis.majorTicks:
183 tick.tick1On = False
184 tick.tick2On = False
185 self.metaaxes.set_yticklabels([])
186 self.metaaxes.set_yticks([])
187 size = [0] * 4
188 size[0] = self.figure_size[0]
189 size[1] = self.figure_size[1] + .12

--- 45 unchanged lines hidden (view full) ---

235 elif self.ylim is not None:
236 self.inner_axes.set_ylim(self.ylim)
237
238 if self.xticks is not None:
239 outer_axes.set_xticks(arange(cshape[2]) + .5)
240 outer_axes.set_xticklabels(self.xticks)
241
242 if self.xsubticks is not None:
242 inner_axes.set_xticks(arange((cshape[0] + 1)*cshape[2])*width + 2*center)
243 numticks = (cshape[0] + 1) * cshape[2]
244 inner_axes.set_xticks(arange(numticks) * width + 2 * center)
243 self.xsubticks.append('')
245 self.xsubticks.append('')
244 inner_axes.set_xticklabels(self.xsubticks * cshape[2], fontsize=7, rotation=90)
246 inner_axes.set_xticklabels(self.xsubticks * cshape[2], fontsize=7,
247 rotation=90)
245
246 if self.legend is not None:
247 if dim == 1:
248 lbars = bars[0][0]
249 if dim == 2:
250 lbars = [ bars[i][0][0] for i in xrange(len(bars))]
251 if dim == 3:
252 number = len(bars[0])

--- 23 unchanged lines hidden (view full) ---

276 f.write(', '.join([ '%f' % val for val in data]) + '\n')
277 if dim == 2:
278 #if self.xlabel:
279 # f.write(', '.join([''] + list(self.xlabel)) + '\n')
280 for i,row in enumerate(data):
281 ylabel = []
282 #if self.ylabel:
283 # ylabel = [ self.ylabel[i] ]
248
249 if self.legend is not None:
250 if dim == 1:
251 lbars = bars[0][0]
252 if dim == 2:
253 lbars = [ bars[i][0][0] for i in xrange(len(bars))]
254 if dim == 3:
255 number = len(bars[0])

--- 23 unchanged lines hidden (view full) ---

279 f.write(', '.join([ '%f' % val for val in data]) + '\n')
280 if dim == 2:
281 #if self.xlabel:
282 # f.write(', '.join([''] + list(self.xlabel)) + '\n')
283 for i,row in enumerate(data):
284 ylabel = []
285 #if self.ylabel:
286 # ylabel = [ self.ylabel[i] ]
284 f.write(', '.join(ylabel + [ '%f' % val for val in row]) + '\n')
287 f.write(', '.join(ylabel + [ '%f' % v for v in row]) + '\n')
285 if dim == 3:
286 f.write("don't do 3D csv files\n")
287 pass
288
289 f.close()
290
291if __name__ == '__main__':
292 from random import randrange

--- 46 unchanged lines hidden ---
288 if dim == 3:
289 f.write("don't do 3D csv files\n")
290 pass
291
292 f.close()
293
294if __name__ == '__main__':
295 from random import randrange

--- 46 unchanged lines hidden ---