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
fixes pyglet doctest problems

fixes TypeError and KeyError exceptions in the pygletplot package

    Traceback (most recent call last):
      File "/usr/lib64/python2.7/doctest.py", line 1289, in __run
        compileflags, 1) in test.globs
      File "<doctest sympy.plotting.pygletplot.__init__.PygletPlot[29]>", line 1, in <module>
        p[2] = -x**2-y**2
      File "sympy/plotting/pygletplot/plot.py", line 320, in __setitem__
        f = PlotMode(*args, **kwargs)
      File "sympy/plotting/pygletplot/plot_mode_base.py", line 164, in __init__
        self.style = self.options.pop('style', '')
      File "sympy/plotting/pygletplot/plot_mode_base.py", line 174, in w
        r = f(self, *args, **kwargs)
      File "sympy/plotting/pygletplot/plot_mode_base.py", line 327, in _set_style
        v = ['both', 'solid'][step_max > 40]
    TypeError: list indices must be integers, not BooleanFalse

    Traceback (most recent call last):
      File "/usr/lib64/python2.7/doctest.py", line 1289, in __run
        compileflags, 1) in test.globs
      File "<doctest sympy.plotting.pygletplot.__init__.PygletPlot[30]>", line 1, in <module>
        p[2].style = 'wireframe'
      File "sympy/plotting/pygletplot/plot.py", line 301, in __getitem__
        return self._functions[i]
    KeyError: 2

Signed-off-by: Thomas Hisch <t.hisch@gmail.com>