actually gets the ids right, rather than printing the indexes to the legend.