scripts to work with MATLAB legends