Automatic sizing for the Legend section

fix #10