Note

Go to the endto download the full example code.

Findobj Demo#

Recursively find all objects that match some criteria

Minimum Message Length
importmatplotlib.pyplotaspltimportnumpyasnpimportmatplotlib.textastexta=np.arange(0,3,.02)b=np.arange(0,3,.02)c=np.exp(a)d=c[::-1]fig,ax=plt.subplots()plt.plot(a,c,'k--',a,d,'k:',a,c+d,'k')plt.legend(('Model length','Data length','Total message length'),loc='upper center',shadow=True)plt.ylim([-1,20])plt.grid(False)plt.xlabel('Model complexity --->')plt.ylabel('Message length --->')plt.title('Minimum Message Length')# match on arbitrary functiondefmyfunc(x):returnhasattr(x,'set_color')andnothasattr(x,'set_facecolor')foroinfig.findobj(myfunc):o.set_color('blue')# match on class instancesforoinfig.findobj(text.Text):o.set_fontstyle('italic')plt.show()

Gallery generated by Sphinx-Gallery