I am trying to make the table at the bottom and the lines the same color. I
took the code from one of the online examples and modified it to do most of
what I want but cannot get the color in the table working properly! Can
someone please help? Thank you
#!/usr/bin/env python
import matplotlib
from pylab import *
from matplotlib.colors import colorConverter
color3=(1,0,0)
axes([0.2, 0.2, 0.7, 0.6]) # leave room below the axes for the table
data = [[
100.00,349.75,171.44,625.53,134635.8,248978.4,160392.1,179662.4,123550.5],
[
235998.8,99972.15,242081.6,84912.13,243705.3,247201.2,203676.4,90139.60,113332.5],
[
202610.0,127785.3,182007.1,175678.0,154024.1,188675.2,166227.0,94719.93,160227.7],
[
31699.09,30586.87,30587.58,33440.05,32209.72,34223.97,28250.25,32070.29,19095.30],
[
84414.35,21884.88,49538.22,49200.55,42394.29,66676.73,57740.81,73549.68,48402.48],
[ 0.0,0.0,0.0,0.0,023529.88,19822.02,35243.35,34349.67,19382.45]]
title('Title')
colLabels = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep')
rowLabels = ['Dr %d' % x for x in (1, 2, 3, 7, 8, 10)]
linecolor = ('blue','red','green','black','yellow','cyan','magenta')
rows = len(data)
ind = arange(len(colLabels)) # the x locations for the groups
cellText = []
yoff = array([0.0] * len(colLabels)) # the bottom values for stacked bar
chart
for row in xrange(rows):
plot(arange(0,9), data[row],color=linecolor[row])
yoff = data[row]
cellText.append(['%1.2f' % (x) for x in yoff])
# Add a table at the bottom of the axes
#title([color3])
the_table = table(cellText=cellText,
rowLabels=rowLabels, rowColours=[color3]*16,
colLabels=colLabels,
loc='bottom')
vals = arange(0, 350000, 25000)
yticks(vals, ['%d' % val for val in vals])
xticks([])
savefig("tony.png",dpi=(1024/8))
···
–
View this message in context: http://old.nabble.com/Color-in-table-help-please!--I-have-already-searched-previous-posts-tp27613553p27613553.html
Sent from the matplotlib - users mailing list archive at Nabble.com.