Fix warnings, test failures, and skip specific tests if matplotlib is not installed