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 chart. 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 used is: ax2 = fig.add_subplot(211) ax2.set_xlim((lstDateOrd[0],lstDateOrd[-1])) a = PL.uniform(low=0,high=1,size=(7,len(lstDateOrd)-1)) ax2.imshow(a, origin='lower', interpolation='nearest', alpha=0.8) ax2.set_xticks([]) ax2.set_yticks([]) 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 __init__ mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax AttributeError: 'NoneType' object has no attribute 'autoscale_None' Thanks. -- 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. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users