WIP: overhaul matplotlib imshow plugin for new data policy

See point 3 of #1266. 

Some of the new code is a little bit messy, so feedback welcome.
Empty line