A more flexible legend for Matlab