From: Charles <ct...@cs...> - 2003-11-12 01:45:42
|
Hi John, I added one line that shows the problem. If you do a set_xticks() first, then the usual ([]) doesn't blank them. Here's code that should suppress the xticks for all but the bottom-most graphs in each column. It works if you comment out the set_xticks line (HERE HERE HERE). Is this comment better for -users or -devel? Or bug tracking? -Charles # -*- Mode: Python; py-indent-offset: 4 -*- # Simple example to demonstrate ticklabel problem # If you don't set_ticks first, the following works fine. # If you do set_ticks, then ([]) doesn't blank the ticklabels. # --crt from matplotlib.matlab import * NUMPLOTS = 8 COLS = 3 ROWS = NUMPLOTS / COLS if NUMPLOTS % COLS: ROWS += 1 t = arange(0.0, 2.0, 0.01) s = sin(2*pi*t) for i in range(1,NUMPLOTS+1): ax = subplot (ROWS, COLS, i) plot(t, s) for i in range(1,NUMPLOTS+1): ax = subplot (ROWS, COLS, i) ax.set_xticks((0,1,2)) # HERE HERE HERE title('Simple ' + str(i)) if i % COLS == 1: # left edge ax.set_ylabel('voltage (mV)') else: ax.set_yticklabels ([]) if i > NUMPLOTS - COLS: # nothing below them ax.set_xlabel('time (s)') else: ax.set_xticklabels ([]) savefig('simple_plot') show() -- Charles R. Twardy www.csse.monash.edu.au/~ctwardy Monash University sarbayes.org Computer Sci. & Software Eng. +61(3) 9905 5823 (w) 5146 (fax) |