Tests for pyplot and minor fixes