changed axis indexing in the legend code to work after forcing all axis lists to be 2D