I'm making a custom plot configure function plt_configure, so I can combine label, legend and other plot options with one command.
For legend, I want to do something like:
plt_configure(legend={loc: 'best'})
# => plt.legend(loc='best')
plt_configure(legend=True)
# => plt.legend()
Then how should I define the function?
Now I define the function as this:
def plt_configure(xlabel='', ylabel='', legend=False):
plt.xlabel(xlabel)
plt.ylabel(ylabel)
if legend:
# if legend passed as options
plt.legend(options)
or my function design is bad, what would be a good design to consider the above 2 case? # else plt.legend()