plot_implicit and legend

The return value of self.ax.legend() should be checked first and then
the call to set_visible() be made.
Merge pull request #7400 from amitsaha/plot_implicit

plot_implicit and legend