Add missing requires for matplotlib.

Change-Id: I7b5eca818ab02707cb28bfb0a71d94d151e84a78
Don't use hardcoded /tmp/dirname for tests.

Not only a security issue, also prevents different users running tests
on one computer.

Change-Id: Iac9594c69f533cc267979eafa639c298a8926f47