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
http://www.nabble.com/file/p14841528/Example1.png 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
http://www.nabble.com/file/p14841528/Example2.png Example2.png . The code I
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\colorbar.py", line 525, in
mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax
AttributeError: 'NoneType' object has no attribute 'autoscale_None'
View this message in context: http://www.nabble.com/Barchart-and-imshow-tp14841528p14841528.html
Sent from the matplotlib - users mailing list archive at Nabble.com.