From: Cesar E. G. D. <cg...@es...> - 2010-10-25 15:04:34
|
Hi! I am using mpl_toolkits.axes_grid.Grid to plot for plots together using the following code inspired in a matlotlib example: import matplotlib.pyplot as plt from mpl_toolkits.axes_grid import Grid import numpy as np im = np.arange(0,3, 0.01) fig = plt.figure(1, (8., 8.)) grid = Grid(fig, 111, nrows_ncols = (2, 2)) for i in range(4): grid[i].plot(im, np.sin(im)) grid[i].grid(True) plt.show() It works "almost" fine, except for the line grid[i].grid(True) which doesn't draw the axis grid defined by the ticklabels. When using add_subplot instead of Grid it works properly, tough, like this: import matplotlib.pyplot as plt from mpl_toolkits.axes_grid import Grid import numpy as np im = np.arange(0,3, 0.01) fig = plt.figure(1, (8., 8.)) subplot = fig.add_subplot(111) subplot.plot(im, np.sin(im)) subplot.grid(True) plt.show() How is it possible to get the same result within each grid[i]? Thank you very much in advance! Enrique |