Data analysis - seaborn module

Use references

 import seaborn as sns 

Brief

Matplotlib module of the second package, the bottom still use or matplotlib, but on the basis of a lot more ease of use templates, more convenient to use

Contrast matplotlib default style

The default method style - set

The default theme style

Set style - set_style

Optional parameters 

  • darkgrid
  • whitegrid
  • dark
  • white
  • ticks

white style

Completely clear the background color, no score line and no scale

drak style

Dark gray background color, no score line and no scale

 

whitegrid style

Y-axis data having scorelines, clear background

ticks style

With scale

 

darkgrid style

With x, y score lines, and dark gray background, no scale

Batch execution style - axes_style

In this indent may apply the style, when drawing a sub picture using this method to set a different style may be more intuitive to see the difference, to facilitate the observation

Custom style modification

The default theme style is relatively fixed, some can be modified to meet custom on this basis

Modify the boundary line - despine 

Removing the top and right lines, 

Parameters can be provided   offset  from the axis of the coordinate value provided

 Can set the parameters   left   removed around the boundary line, other orientations optional yes,   Top  ,   bottom  ,   right 

Modify the layout - set_context 

Optional style 

  • paper
  • talk
  • poster
  • notebook

Size from small to large, the inside of the lattice can see oh

Optional parameters   font_scale  set the font size

 

可选参数  rc  设定线的粗细

 

调色板

  • 颜色很重要
  • color_palette()能传入任何Matplotlib所支持的颜色
  • color_palette()不写参数则默认颜色
  • set_palette()设置所有图的颜色

默认色板 - color_palette

6个默认的颜色循环主题:  deep ,  muted ,  pastel ,  bright ,  dark ,  colorblind 

圆形画板

当你有六个以上的分类要区分时,最简单的方法就是在一个圆形的颜色空间中画出均匀间隔的颜色(这样的色调会保持亮度和饱和度不变)。

这是大多数的当他们需要使用比当前默认颜色循环中设置的颜色更多时的默认方案。

最常用的方法是使用  hls  的颜色空间,这是RGB值的一个简单转换。

使用方法具体就是输入一个数字, 则输出多少颜色

 

 

Guess you like

Origin www.cnblogs.com/shijieli/p/11326509.html