Changing the color of Seaborn legends
Just with the use of matplotlib.pyplot.set_facecolor() function from matplotlib library and pass the name of the color user want to in the seaborn legends.
Python3
# import modules import matplotlib.pyplot as plt import numpy as np # depict illustration g = np.random.rand( 20 , 1 ) plt.plot(g, label = 'gfg' ) legend = plt.legend() frame = legend.get_frame() frame.set_facecolor( 'green' ) plt.show() |
Output:
How to change Seaborn legends font size, location and color?
Seaborn is a library for making statistical graphics on top of matplotlib with pandas data structures in python. Seaborn legend is the dialog box which is located on the graph which includes the description of the different attributes with their respected colors in the graph. We can easily change the properties of the seaborn legend including font size, location, background colour, and many others.
Here, We will learn about the way to change the font size, location, and the color of seaborn legend.
Contact Us