Tidied up imports of optional dependencies

... so that they are only imported at runtime and don't emit warnings when ``aplpy`` is imported.