-def plot_datehist(ax, data, bins, suites, title=None, ymax=None):
- colors=['#ff0088', '#20435C', '#45902C', '#E08720']
- linestyle=['-', '--']
- global_x_max = None
- global_x_min = None
- global_y_max = None
- for i, suite in enumerate(suites):
- dates = data['date'][data['suite'] == suite]
- # history in days
- history_length = dates.max() - dates.min()
- # make approx monthly bins, smaller bins yield spiky curves
- # needs new=True to work with oldish numpy
- (hist, bin_edges) = np.histogram(dates, np.ceil(history_length/30.), new=True)
- if len(bin_edges) < 2:
- # protect against single data point entries by ignoring them
- # wouldn't be able to draw a line anyway ;-)
- continue
- width = bin_edges[1] - bin_edges[0]
- # think lines
- ax.plot(bin_edges[:-1]+(width/2), hist / width,
- label=suite, color=colors[i%4], linestyle=linestyle[i//4], lw=2)
- # transparent curve shading
- ax.fill_between(bin_edges[:-1]+(width/2), 0, hist / width, alpha=0.2,
- label=suite, color=colors[i%4])
- # figure out axis limits to avoid whitespace in plots
- x_max = bin_edges[-2] + width/2
- x_min = bin_edges[0] + width/2
- if global_x_max is None or x_max > global_x_max:
- global_x_max = x_max
- if global_x_min is None or x_min < global_x_min:
- global_x_min = x_min
-
- ax.set_xlim(global_x_min, global_x_max)
- ax.set_ylabel('New subscriptions [1/day]')
- if title:
- ax.set_title(title)
- if ymax:
- ax.set_ylim(0, ymax)
-
- # set x-ticks in date
- # see: http://matplotlib.sourceforge.net/examples/api/date_demo.html
- ax.xaxis.set_major_locator(YearLocator())
- ax.xaxis.set_major_formatter(DateFormatter('\n\n%Y'))
- ax.xaxis.set_minor_locator(MonthLocator())
- ax.xaxis.set_minor_formatter(DateFormatter('%b'))
- # format the coords message box
- ax.format_xdata = DateFormatter('%Y-%m-%d')
- ax.grid(True)
- # pukes with old matplotlib
- #font = FontProperties()
- #font.set_size = 8
- pl.legend(loc='upper left', #prop=font,
- labelspacing=.2, borderaxespad=.2,
- handletextpad=.2, borderpad=.2)
+releases = {
+ 'etch': 'Debian GNU/Linux 4.0 (etch)',
+ 'lenny': 'Debian GNU/Linux 5.0 (lenny)',
+ 'squeeze': 'Debian GNU/Linux 6.0 (squeeze)',
+ 'wheezy': 'Debian GNU/Linux 7.0 (wheezy)',
+ 'jessie': 'Debian testing (jessie)',
+ 'sid': 'Debian unstable (sid)',
+ 'hardy': 'Ubuntu 08.04 LTS "Hardy Heron" (hardy)',
+ 'jaunty': 'Ubuntu 09.04 "Jaunty Jackalope" (jaunty)',
+ 'karmic': 'Ubuntu 09.10 "Karmic Koala" (karmic)',
+ 'lucid': 'Ubuntu 10.04 LTS "Lucid Lynx" (lucid)',
+ 'maverick': 'Ubuntu 10.10 "Maverick Meerkat" (maverick)',
+ 'natty': 'Ubuntu 11.04 "Natty Narwhal" (natty)',
+ 'oneiric': 'Ubuntu 11.10 "Oneiric Ocelot" (oneiric)',
+ 'precise': 'Ubuntu 12.04 LTS "Precise Pangolin" (precise)',
+ 'quantal': 'Ubuntu 12.10 "Quantal Quetzal" (quantal)',
+ 'raring': 'Ubuntu 13.04 "Raring Ringtail" (raring)',
+ 'saucy': 'Ubuntu 13.10 "Saucy Salamander" (saucy)',
+ 'trusty': 'Ubuntu 14.04 "Trusty Tahr" (trusty)',
+}