Fix hist for log=True and histtype='step'

Rebased version of #1029 to target v1.2.x. This aims to fix #196 but is currently incomplete.