Data visualization using seaborn

Sns use the following aliases as seaborn

1.seaborn overall layout settings

  sns.set_syle () function sets the drawing style, the incoming parameter can be "darkgrid", "whitegrid", "dark", "white", "ticks", representing the five styles. sns.despine () can be removed and the right upper edges.

The following code five styles depicted in Fig.

 1 import seaborn as sns
 2 import numpy as np
 3 import matplotlib as mpl
 4 import matplotlib.pyplot as plt
 5 
 6 
 7 def sinplot(ax):
 8     x = np.linspace(0, 14, 100)
 9     for i in range(6):
10         y = np.sin(x+i*5)*(7-i)
11         ax.plot(x, y)
12 
13 
14 style = [ " darkgrid " , " whitegrid " , " Dark " , " White " , " ticks " ]
 15 Print (style [ 0 ])
 16  
. 17 plt.figure (figsize = ( 10 , 10 ))
 18 is  for I in Range ( . 5 ):
 . 19      sns.set_style (style [I]) # must be provided prior to the style defined in the sub-graph! ! ! ! ! ! !
20 is      AX = plt.subplot ( 2 , . 3 , I +1)
21     ax.set_title(style[i])
22     sinplot(ax)
23 
24 plt.show()

Results are as follows

 

Guess you like

Origin www.cnblogs.com/loubin/p/11257354.html