#!/usr/bin/env python from matplotlib import matlab data = ((3,1000), (10,3), (100,30), (500, 800), (50,1)) matlab.xlabel("FOO") matlab.ylabel("FOO") matlab.title("Testing") matlab.gca().set_yscale('log') dim = len(data[0]) w = 0.75 dimw = w / dim x = matlab.arange(len(data)) for i in range(len(data[0])) : y = [d[i] for d in data] b = matlab.bar(x + i * dimw, y, dimw, bottom=0.001) matlab.gca().set_xticks(x + w / 2) matlab.gca().set_ylim( (0.001,1000)) matlab.show()
#!/usr/bin/env python from matplotlib import matlab data = ((3, 1000), (10, 3), (100, 30), (500, 800), (50, 1)) matlab.xlabel("FOO") matlab.ylabel("FOO") matlab.title("Testing") matlab.gca().set_yscale('log') dim = len(data[0]) w = 0.75 dimw = w / dim x = matlab.arange(len(data)) for i in range(len(data[0])): y = [d[i] for d in data] b = matlab.bar(x + i * dimw, y, dimw, bottom=0.001) matlab.gca().set_xticks(x + w / 2) matlab.gca().set_ylim((0.001, 1000)) matlab.show()
# a 16,16 array of character strings chars = [ ['' for c in range(16)] for r in range(16)] colors = [ [0.95 for c in range(16)] for r in range(16)] figure(figsize=(8,4),dpi=120) for glyphind, ccode in codes: if ccode>=256: continue r,c = divmod(ccode,16) s = chr(ccode) chars[r][c] = s lightgrn = (0.5,0.8,0.5) title(fontname) tab = table(cellText=chars, rowLabels=labelr, colLabels=labelc, rowColours=[lightgrn]*16, colColours=[lightgrn]*16, cellColours=colors, cellLoc='center', loc='upper left') for key, cell in tab.get_celld().items(): row, col = key if row>0 and col>0: cell.set_text_props(fontproperties=FontProperties(fname=sys.argv[1])) axis('off') show()