![title for subplot matlab title for subplot matlab](https://img-blog.csdnimg.cn/img_convert/b25b8c22b2dd6a91141cfbb9b0d85f57.png)
My testing in R2016a suggests that after plotyy () calls, the current axes is not changed - though I did not. If you use Matlab-like style in the interactive plotting, then you could use plt.gca() to get the reference of the current axes of the subplot and combine set_title() or t_text() method to set title to the subplots in Matplotlib. The outputs you show for plot () tell me that you are not using plot (), that instead you are using plotyy () - plot () does not return the axes but plotyy () does. Plt.gca().set_title() / _text() to Set Title to Subplots in Matplotlib import numpy as npĪx.t_text("Cosine function")Īx.t_text("Sigmoid function")Īx.t_text("Exponential function") We can also add title to subplots in Matplotlib using t_text() method, in similar way to set_title() method. t_text() Method to Set Title of Subplots in Matplotlib If we want to loop over some subplots and show them one at a time along with titles, we can use the following shorter code: import numpy as np import numpy as npĪx.set_title("Exponential function")Ĭreate Custom Data Labels. We use matplotlib.axes._title(label) method to set title (string label) for the current subplot Axes. Set_title() Method to Add Title to Subplot in Matplotlib We use set_title(label) and t_text(label) methods to add titles to subplots in Matplotlib. plt.gca().set_title() / _text() to Set Title to Subplots in Matplotlib.t_text() Method to Set Title of Subplots in Matplotlib.Set_title() Method to Add Title to Subplot in Matplotlib.