Based on what I see in this post, I tried to write this piece of code but it gives me error.
ticklabels = ax.get_xticklabels()
set_color = operator.methodcaller('set_color("b")')
ticklabels[0].set_color('b') # this runs fine
map(set_color, ticklabels) #error is here
Error code:
map(set_color, ticklabels) AttributeError: 'Text' object has no attribute 'set_color("b")'
Can't you pass argument to the function in methodcaller?
map(lambda x:x.set_color, ticklabels)work?lambda. Thanks for mentioning that.lambdavariant should bemap(lambda x: x.set_color('b'), ticklabels)