[Matplotlib-users] table on right and rotating the table entries
I looked at the examples online and have searched the newsgroup and am stuck. I figured out how to place the table on the right hand side but now I would like to have the table display as follows: colors for headding date clear Left in blueright in red date Left Right 1.1.2001 4 5.5 1.1.2003 03 3.5 etc. The attached code should be fully runable so you can see what it is doing and what I am trying to do Thank you duckman #!/usr/bin/python import matplotlib import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab import matplotlib.ticker as ticker from pylab import * from matplotlib.colors import colorConverter axes([0.03, 0.2, 0.9, 0.7]) data = [[4,03,11,11.1,12.5,12.9,11.1,11,11.3,21,13.4,12,21,21,11,15.55,12,22,22,11.1,14,17,13,12,13,10,16.0,14.5,12,12,12,12,12,12,13,13,14,14,13,13,14,14,14,14,12,12,13], [5.5,03.5,11.11,11.2,13.9,19.3,11.1,41,12.3,22.0,12.8,13,30,21.5,31,17.05,15,23,33,11.2,15,18,13,13,11,18.2,21,19.5,16,16,13,13,13,13,14,14,14,14,14,14,14,14,15,15,12,12,14]] title('Hop History for John doe \n 02.20.2010') locs, colLabels = xticks([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46], ['01.01.2001', '01.01.2003', '08.01.2004', '03.03.2007', '06.08.2007', '06.12.2007', '01.01.2008', '02.25.2008', '04.04.2008', '05.27.2008', '05.27.2008', '05.27.2008', '05.27.2008', '05.27.2008', '05.30.2008', '06.01.2008', '06.11.2008', '06.11.2008', '06.19.2008', '06.19.2008', '06.19.2008', '07.10.2008', '07.10.2008', '07.10.2008', '07.10.2008', '07.18.2008', '07.22.2008', '07.22.2008', '01.27.2009', '01.27.2009', '02.24.2009', '02.24.2009', '02.24.2009', '02.24.2009', '05.19.2009', '05.19.2009', '05.19.2009', '05.19.2009', '06.05.2009', '06.05.2009', '06.05.2009', '06.05.2009', '06.29.2009', '06.29.2009', '08.28.2009', '08.28.2009', '11.23.2009']) rowLabels = ('Right', 'Left') linecolor = ('#3300ff','#ff') vals = arange(1, 43, 2) rows = len(data) ind = arange(len(colLabels)) cellText = [] #for row in xrange(rows): #coff = colLabels[row] #cellText.append(['%1.2f' % (x) for x in coff]) for row in xrange(rows): plot(arange(0,47), data[row], '.-', color=linecolor[row]) yoff = data[row] cellText.append(['%1.0f' % (x) for x in yoff]) yticks(vals, ['%d' % val for val in vals]) setp(colLabels, 'rotation', '90') legend(('Right','Left')) the_table = table(cellText=cellText, cellLoc='right', rowLabels=rowLabels, rowColours=linecolor, rowLoc='left', colLabels=colLabels, colLoc='right', loc='right') savefig(/var/www/html/mfx/419/graph.png,dpi=(1024/4)) -- View this message in context: http://old.nabble.com/table-on-right-and-rotating-the-table-entries-tp27714264p27714264.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- Download Intel#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Color in table help please! I have already searched previous posts
That actually did it. I thought I had tried this several times and kept getting errors. It would not take the color names like red, blue etc. But when I changed it as suggested it worked! Thank you! Jae-Joon Lee wrote: On Tue, Feb 16, 2010 at 2:15 PM, duckman tduck...@crowellsystems.com wrote: 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 Do you want the background of the row labels to match your line colors? The answer seems to be so trivial and I'm not sure if this is what you want. the_table = table(cellText=cellText, rowLabels=rowLabels, rowColours=linecolor, colLabels=colLabels, loc='bottom') -JJ -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- View this message in context: http://old.nabble.com/Color-in-table-help-please%21--I-have-already-searched-previous-posts-tp27613553p27623776.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Color in table help please! I have already searched previous posts
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, 35, 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%21--I-have-already-searched-previous-posts-tp27613553p27613553.html Sent from the matplotlib - users mailing list archive at Nabble.com. -- SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users