Using a data frame and this code in Python, I was able to create a plot:
g = sns.lmplot('credibility', 'percentWatched', data=data, hue = 'millennial', markers = ["+", "."], x_jitter = True, y_jitter = True, size=5)
g.set(xlabel = 'Credibility Ranking\n ← Low High →', ylabel = 'Percent of Video Watched [%]')
However having the legend say "+ 0" and ". 1" isn't very helpful to readers. How can I edit the legend's labels? Ideally instead of saying 'millennial' it would say 'Generation' and "+ Millennial" ". Older Generations"
If you just want to change the legend title, you can do the following:
Took me a while to read through the above. This was the answer for me:
Reference this for more arguments: matplotlib.pyplot.legend
If
legend_out
is set toTrue
then legend is available thoughtg._legend
property and it is a part of a figure. Seaborn legend is standard matplotlib legend object. Therefore you may change legend texts like:Another situation if
legend_out
is set toFalse
. You have to define which axes has a legend (in below example this is axis number 0):Moreover you may combine both situations and use this code:
This code works for any seaborn plot which is based on
Grid
class.