You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm always frustrated when: I need to call functions on, say, axes, and my initial attempts fail because a lot of the function names begin with set_, while their pyplot counterparts do not.
ax.set_xlabel('my label') vs. plt.xlabel('my label') ax.set_title('The Title') vs. plt.title('The Title')
Proposed solution
Perhaps create aliases for the axes functions to match the pyplot functions.
The text was updated successfully, but these errors were encountered:
I absolutely get where you're coming from as this is a very frequent source of confusion and frustration, but we've been concerned that exactly matching the OO API to the pyplot API will further blur the boundaries between the two and create more confusion #15938 (comment)
As a general rule, the functions that are methods on the Axes object use the set/get_{} naming convention while the objects that are part of the Matlab like pyplot stateless interface don't, and this is somewhat a legacy of the library code predating python properties.
Is there a different solution that may work here? Possibly a more helpful error message like method does not exist, try set_method/get_method?
ETA: Thinking that may be relatively easy to implement, especially with some upfront work to manually check which methods have correspondences and which don't<-which would maybe be a good page to have in docs? ETA2: Especially since we already document the functions independently in pyplot and axes
Problem
I'm always frustrated when: I need to call functions on, say,
axes
, and my initial attempts fail because a lot of the function names begin withset_
, while theirpyplot
counterparts do not.ax.set_xlabel('my label')
vs.plt.xlabel('my label')
ax.set_title('The Title')
vs.plt.title('The Title')
Proposed solution
Perhaps create aliases for the
axes
functions to match thepyplot
functions.The text was updated successfully, but these errors were encountered: