Unstable legend fix

fixed legend. now it works properly and **kwargs are passed to the set_legend() function.