Hi,
I have to problems when using a table with bar.
On the first one I use this code:
for row in xrange(rows):
bars = axes.bar(ind, yearValues[row], width, bottom=yoff, color=colours[row])
yoff = yoff + yearValues[row]
cellText.append(['%d' % (round(x*1.0, 0)) for x in yearValues[row]])
axes.set_xticks([]) # remove the default ticks
axes.set_ylabel(labelDesc)
# Add a table at the bottom of the axes
the_table = axes.table(cellText=cellText,
rowLabels=rowLabels, rowColours=colours,
colLabels=colLabels,
loc='bottom')
the_table.set_fontsize(10)
My problem is that the bars are taking up to much space and only a portion of my table is shown.
My second problem uses this code:
for row in xrange(rows):
# purchase values
bars = axes.bar(ind, yearValuesP[row], width, bottom=yoffP, color=colours[row])
yoffP = yoffP + yearValuesP[row]
# consumption values
bars = axes.bar(ind, yearValuesC[row], width, bottom=yoffC, color=colours[row])
yoffC = yoffC + yearValuesC[row]
cText = []
for x in range(len(yearValuesP[row])):
xP = round(yearValuesP[row][x], 0)
xC = round(yearValuesC[row][x], 0)
xN = xP + xC
cText.append('%d - %d = %d' % (xP, -xC, xN))
cellText.append(cText)
# add a line to mark zero
axes.axhline(linewidth=4, color='k')
# add a line for net change
netVal = yoffP + yoffC
aLine = axes.plot(indNet, netVal, 'o-', color='blue', linewidth=4)
autolabelLine(aLine, axes)
axes.set_xticks([]) # remove the default ticks
axes.set_ylabel(labelDesc)
# Add a table at the bottom of the axes
the_table = axes.table(cellText=cellText,
rowLabels=rowLabels, rowColours=colours,
colLabels=colLabels,
loc='bottom')
the_table.set_fontsize(10)
Here the full table is shown but the text is too small to read.
In both cases I tried 'axes.autoscale(tight=True)' and played with the font size but with no success.
Would appreciate any tips on what I may do wrong or what else I need to do to have things show correctly.
Werner
P.S.
This is with MPL 1.3.1, with numpy 1.6.1 on Py2.7 32bit on Win7