04 - seaborn

Introduction

seaborn matplotlib is based on a further package, the function will be more powerful

Paint

Here Insert Picture Description
Using the previous matplotlib above or for drawing, painting can be seen that the six different function sin

set

Here Insert Picture Description

set_style

Use the set will use the middle seaborn some default parameters
in the middle seaborn in five theme styles can be used: darkgrid, whitegrid, dark, white , ticks
both of the following on only in the middle of a different style drawing:
Here Insert Picture Description
topic above intermediate style, for every possible scale representation is not very clear, ticks can also use the middle section of the content of each line segment of
Here Insert Picture Description
the graphics at this time each scale has a line of identity

Despina

The above graph, is a box-shaped coordinate axis, but the top and right lines are useless for the analysis, such a case, we can also be used to remove those lines despine method
Here Insert Picture Description
described above, and right above the graph the line had disappeared

offset

Here Insert Picture Description
Sometimes, we do not need the graphics drawn too close to the axis, you can set a parameter offset in the middle despine, this parameter represents the distance between the graphics and the axis

left

When using the foregoing methods despine, above the line will automatically be hidden and right; actually can manually specify, e.g., where the hidden line left
Here Insert Picture Description
set upper left = True, this line will be left hidden

with

Videos required when a plurality of different styles of patterns may be used with painting style specified pattern
Here Insert Picture Description
in the code above the middle, two different styles of painting FIG, used here is the way with FIG specified style setting

set_context

对于图形也是能够指定图像线条的粗细的,这里使用set_context方法,在中间可以加上如下的参数:paper, notebook, talk, poster
上面的这几个参数,从左往右,线条会变得越来越粗

font_scale

在set_context中间,除了上面可以设定线条的粗线外,还能够给坐标轴上面的描述字体进行处理
Here Insert Picture Description
明显能够看到,将font_scale设定为3的时候,图形中间的描述信息的字体变大了

调色板

color_palette

在画图的时候,最为重要的就是需要为所画的图形使用不同的颜色(颜色很重要)
color_palette()能传入任何Matplotlib所支持的颜色
color_palette()不写参数则默认颜色
set_palette()设置所有图的颜色
Here Insert Picture Description
在seaborn中间存在有默认的调色板,上面就是默认的几种颜色
虽然seaborn已经提供了上面这些默认的颜色,但是如果想要描述的对象的数量多余上面这几种颜色,这个时候最简单的方法就是在一个圆形的颜色空间中画出均匀间隔的颜色(这样的色调会保持亮度和饱和度不变)。这是在需要使用比当前默认颜色循环中设置的颜色更多时的默认方案
最常用的方法是hls的颜色空间,这是RGB值的一个简单转换
Here Insert Picture Description
有时候画图的时候,需要的颜色是以“对”的形式出现,例如国家与国家的颜色要明显的区分开,队员的颜色要和国家的颜色差距不能太大,可以使用如下的方式
Here Insert Picture Description
如上图,图形就分成了4对,每一对之间能够很明显的区分开;每一对内部的颜色差距并不是很大

hls_pallete

Use hls_pallete () function to control the brightness and color saturation
l luminance Lightness
S saturation saturation
Here Insert Picture Description

xkcd

xkcd may be directed random RGB color name, produced 954 can always xkcd_rgb dictionary called color naming
Here Insert Picture Description
intermediate code above, use plot draw a straight line when used to xkcd_rgb specified color to a different line (color where commands can be obtained through the official website), the latter represents the width lw
Here Insert Picture Description

color_palette

Here Insert Picture Description
Color_palette swatches using continuous effect can be achieved, given the above parameters, when a Blues, until the color changes from light blue to dark blue back (from shallow to God color); If you want from dark to light then added after the color on a _r suffix to

cubehelix_palette ()

Tone linear transformation
Here Insert Picture Description
in the figure, from left to right depth and color saturation are changing (from dark to light)
Here Insert Picture Description
the above figure, using cubehelix_palette obtain a color change interval

light_palette () and dark_palette () calls the custom palette continuous

Here Insert Picture Description
Can be seen by the above diagram, if you are using the time light_palette, color from light to dark; If you are using the time dark_palette color from dark to light; of course, except for using a specific method name other than the above, If you want to light_palette changed from dark to light the way, only you need to add to reverse
Here Insert Picture Description

Guess you like

Origin blog.csdn.net/Escid/article/details/90690859
04