ENH: allow hist to take a string "by" argument

closes #4103.