From: Daniele N. <da...@gr...> - 2013-10-25 12:45:08
|
On 24/10/2013 21:26, Paul Ivanov wrote: > 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 better, however to create _sub_ plots to have a single plot into a figure still feels weird, also I would expect it to be a method of the Figure class and not a top level function. Furthermore, most documentation refers to add_subplot() and not subplots() which has a more understandable function signature. In principle I think the current API violates the "There should be one-- and preferably only one --obvious way to do it" rule here, and elsewhere :-) I feel the way forward should be to create a cleaner API and map the current one through a compatibility layer to that. Cheers, Daniele |