Barchart and imshow

Hello: I need to create a chart which shows the effect of promotions (eg.
forms of advertisement, discounts, etc.) on sales. The data that I have is:

weekly sales -- sales[sku, week]
promotions -- promotion[prom_name, day]

Currently, I have aggregated the promotion data to week whereby if a
promotion runs during any part of the week I show it against the week. In Example1.png , the
promotions (abbreviated using the first two letters) are shown in yellow
labels. Holidays are shown using blue labels.

The **problem** is that there are part week promotions -- so "Ta" may
produce a very different uplift depending on whether it runs for part of the
week or the whole week, and even if it is running part of the week, which
days it runs.

To display the promotions during each day of the week, I can construct a
matrix of size [rows = 7 days in week, cols = #weeks shown on X axis ]. I
would assign values by powers of 2 for the promotions. None - 1, Ta - 2, Ma
- 4, BA - 8, etc. So, for a day which has Ta and Ba, I would end up with a
value of 10. Hence, I will have a matrix which needs to be displayed on the

My first attempt at displaying a randomly generated matrix is shown in Example2.png . The code I
used is:
    ax2 = fig.add_subplot(211)
    a = PL.uniform(low=0,high=1,size=(7,len(lstDateOrd)-1))
    ax2.imshow(a, origin='lower', interpolation='nearest', alpha=0.8)

Questions -- (1) should I use matshow, imshow, pcolor or pcolormesh? (2) is
it possible to align the columns in the "promotions" color bar with the bars
below? (3) I am not able to set a colorbar; the error I get is:
  File "C:\Python25\Lib\site-packages\matplotlib\", line 525, in
    mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax
AttributeError: 'NoneType' object has no attribute 'autoscale_None'



View this message in context:
Sent from the matplotlib - users mailing list archive at