Check if colorbar is none before seting visibility

I was getting some errors when building figures with multiple layers, some of which I was plotting without a colorbar.

This should fix that.