From: Paul I. <pi...@be...> - 2013-10-24 19:27:03
|
One quick reply: Daniele Nicolodi, on 2013-10-24 21:03, wrote: > One thing I dislike is, for example, the add_subplot() method: > > f = plt.figure() > a = f.add_subplot(111) > a.plot(x, y) > > it feels completely out of place (why I need to add a subplot if the > only thing I want to do is to create a figure with a single plot in it?) > and kind of magic (what is the number 111?). f, a = plt.subplots() a.plot(x, y) that's the way to go there. And if you need to make a regular grid of subplots, you can pass it the number of rows and number of columns, and get a 2D array of subplots out for the second argument. f, axes = plt.subplots(2,3) axes[0,2].plot(range(10)) axes[1,1].plot(-np.arange(10)) f.canvas.draw() best, -- _ / \ A* \^ - ,./ _.`\\ / \ / ,--.S \/ \ / `"~,_ \ \ __o ? _ \<,_ /:\ --(_)/-(_)----.../ | \ --------------.......J Paul Ivanov http://pirsquared.org |