Python之seaborn:利用seaborn的color_palette()函数改变绘图界面风格

简介: Python之seaborn:利用seaborn的color_palette()函数改变绘图界面风格https://img-blog.csdnimg.cn/20200908092945978.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQxMTg1ODY4,size_16,color_FFFFFF,t_70

利用seaborn的color_palette()函数改变绘图界面风格


实现结果


sns.set_style('ticks')   #默认五种风格:darkgrid,whitegrid,dark,white,ticks

image.pngimage.png

image.png



image.png







源代码解释


def set_style Found at: seaborn.rcmod

def set_style(style=None, rc=None):

   """Set the aesthetic style of the plots.

 

   This affects things like the color of the axes, whether a grid is enabled by default, and other aesthetic elements.

 

   Parameters

   ----------

   style : dict, None, or one of {darkgrid, whitegrid, dark, white, ticks}. A dictionary of parameters or the name of a preconfigured set.

   rc : dict, optional. Parameter mappings to override the values in the preset seaborn style dictionaries. This only updates parameters that are considered part of the style definition.

设定了绘图的美学风格。

这将影响轴的颜色、是否默认启用网格以及其他美学元素。

参数

----------

style : dict,无,或一个{darkgrid,暗网格,whitegrid白格子,dark黑,white白,ticks}。参数的字典或预先配置的参数集的名称。

rc: dict,可选。参数映射,以覆盖预设的seaborn样式字典中的值。这只更新被认为是样式定义的一部分的参数。

   Examples

   --------

   >>> set_style("whitegrid")

 

   >>> set_style("ticks", {"xtick.major.size": 8, "ytick.major.size": 8})

   See Also

   --------

   axes_style : return a dict of parameters or use in a ``with`` statement to temporarily set the style.

   set_context : set parameters to scale plot elements

   set_palette : set the default color palette for figures

 

   """

   style_object = axes_style(style, rc)

   mpl.rcParams.update(style_object)

axes_style: 返回一组参数或在' ' with ' '语句中使用来临时设置样式。

set_context: 设置参数来缩放图形元素。

set_palette: 设置图形的默认调色板。

   Examples

   --------

   >>> set_style("whitegrid")

 

   >>> set_style("ticks", {"xtick.major.size": 8, "ytick.major.size": 8})

   See Also

   --------

   axes_style : return a dict of parameters or use in a ``with`` statement to temporarily set the style.

   set_context : set parameters to scale plot elements

   set_palette : set the default color palette for figures

 

   """

   style_object = axes_style(style, rc)

   mpl.rcParams.update(style_object)

 


相关文章
|
3天前
|
数据可视化 数据挖掘 API
Python中的数据可视化利器:Matplotlib与Seaborn对比解析
在Python数据科学领域,数据可视化是一个重要环节。它不仅帮助我们理解数据,更能够让我们洞察数据背后的故事。本文将深入探讨两种广泛使用的数据可视化库——Matplotlib与Seaborn,通过对比它们的特点、优劣势以及适用场景,为读者提供一个清晰的选择指南。无论是初学者还是有经验的开发者,都能从中找到有价值的信息,提升自己的数据可视化技能。
|
4天前
|
Python
python函数进阶
python函数进阶
|
4天前
|
安全 Python
Python量化炒股的获取数据函数—get_industry()
Python量化炒股的获取数据函数—get_industry()
12 3
|
4天前
|
Python
Python sorted() 函数和sort()函数对比分析
Python sorted() 函数和sort()函数对比分析
|
4天前
|
Python
Python量化炒股的获取数据函数—get_security_info()
Python量化炒股的获取数据函数—get_security_info()
12 1
|
4天前
|
Python
Python量化炒股的获取数据函数— get_billboard_list()
Python量化炒股的获取数据函数— get_billboard_list()
10 0
|
4天前
|
安全 数据库 数据格式
Python量化炒股的获取数据函数—get_fundamentals()
Python量化炒股的获取数据函数—get_fundamentals()
11 0
|
5天前
|
算法 Python
Python编程的函数—内置函数
Python编程的函数—内置函数
|
5天前
|
Java C++ Python
30天拿下Python之函数
30天拿下Python之函数
|
5天前
|
Python
Python量化炒股的获取数据函数—get_index_weights()
Python量化炒股的获取数据函数—get_index_weights()
14 0
下一篇
无影云桌面