最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Python可視化之seborn圖形外觀設(shè)置

 更新時(shí)間:2022年03月03日 08:27:20   作者:?pythonic生物人  
這篇文章主要介紹了Python可視化之seborn圖形外觀設(shè)置,本文介紹seaborn圖形外觀、圖形縮放設(shè)置.具有一的的參考價(jià)值,需要的小伙伴可以參考一下

本文將了解什么?

1、設(shè)置背景風(fēng)格

  •  使用set_style設(shè)置圖形背景風(fēng)格
  •  不同子圖使用不同背景風(fēng)格 
  •  自定義背景風(fēng)格  

2、設(shè)置外框(脊柱)
3、圖形縮放
4、同時(shí)設(shè)置背景|圖形縮放

1、設(shè)置背景風(fēng)格

使用set_style設(shè)置圖形背景風(fēng)格

#seaborn包含5中背景風(fēng)格darkgrid, whitegrid, dark, white, ticks,默認(rèn)為dark
#set_style()修改風(fēng)格,以下展示5種風(fēng)格差異
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
for i in list('darkgrid, whitegrid, dark, white, ticks'.split(', ')):
? ? sns.set_style(style='%s'%i)
? ? plt.figure()
? ? plt.plot(range(10),[i+1 for i in range(10)])?
? ? plt.title('%s'%i)

不同子圖使用不同背景風(fēng)格

axes_style() 結(jié)合with

f = plt.figure(figsize=(6, 6))
gs = f.add_gridspec(2, 2)

with sns.axes_style("darkgrid"):
? ? ax = f.add_subplot(gs[0, 0])
? ? plt.plot(range(10),[i+1 for i in range(10)])

with sns.axes_style("white"):
? ? ax = f.add_subplot(gs[0, 1])
? ? plt.plot(range(10),[i+1 for i in range(10)])

with sns.axes_style("ticks"):
? ? ax = f.add_subplot(gs[1, 0])
? ? plt.plot(range(10),[i+1 for i in range(10)])

with sns.axes_style("whitegrid"):
? ? ax = f.add_subplot(gs[1, 1])
? ? plt.plot(range(10),[i+1 for i in range(10)])

f.tight_layout()

自定義背景風(fēng)格

sns.axes_style('darkgrid')#輸出'darkgrid'默認(rèn)配置

{'figure.facecolor': 'white',
?'axes.labelcolor': '.15',
?'xtick.direction': 'out',
?'ytick.direction': 'out',
?'xtick.color': '.15',
?'ytick.color': '.15',
?'axes.axisbelow': True,
?'grid.linestyle': '-',
?'text.color': '.15',
?'font.family': ['sans-serif'],
?'font.sans-serif': ['Arial',
? 'DejaVu Sans',
? 'Liberation Sans',
? 'Bitstream Vera Sans',
? 'sans-serif'],
?'lines.solid_capstyle': 'round',
?'patch.edgecolor': 'w',
?'patch.force_edgecolor': True,
?'image.cmap': 'rocket',
?'xtick.top': False,
?'ytick.right': False,
?'axes.grid': True,
?'axes.facecolor': '#EAEAF2',
?'axes.edgecolor': 'white',
?'grid.color': 'white',
?'axes.spines.left': True,
?'axes.spines.bottom': True,
?'axes.spines.right': True,
?'axes.spines.top': True,
?'xtick.bottom': False,
?'ytick.left': False}
sns.set_style("darkgrid", {"axes.facecolor": "pink"})#修改背景色
plt.plot(range(10),[i+1 for i in range(10)])

2、設(shè)置外框(脊柱)

seaborn.despine

plt.plot(range(10),[i+1 for i in range(10)])
sns.despine(fig=None, ax=None,?
? ? ? ? ? ? top=True, right=True, left=False, bottom=False, #上,右,左,下外框開關(guān)
? ? ? ? ? ? offset=None, trim=False
? ? ? ? ? ?)

3、圖形縮放

plotting_context() set_context()

#seaborn包含4模式可選:paper,notebook,talk,poster,默認(rèn)為notebook
#set_context()修改模式,以下展示4種風(fēng)格差異
for i in list('paper,notebook,talk,poster'.split(',')):
? ? sns.set_context(context='%s'%i)
? ? plt.figure(dpi=80)
? ? plt.plot(range(10),[i+1 for i in range(10)])?
? ? plt.title('%s'%i)

4、同時(shí)設(shè)置背景|圖形縮放

set()

sns.set(context='notebook', #設(shè)置縮放
? ? ? ? style='darkgrid', #設(shè)置背景風(fēng)格
? ? ? ? palette='deep', #設(shè)置colormap
? ? ? ? font='sans-serif', font_scale=1, color_codes=True, rc=None)

到此這篇關(guān)于Python可視化之seborn圖形外觀設(shè)置的文章就介紹到這了,更多相關(guān)seborn圖形外觀設(shè)置內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Python?matplotlib繪圖時(shí)使用鼠標(biāo)滾輪放大/縮小圖像

    Python?matplotlib繪圖時(shí)使用鼠標(biāo)滾輪放大/縮小圖像

    Matplotlib是Python程序員可用的事實(shí)上的繪圖庫(kù),雖然它比交互式繪圖庫(kù)在圖形上更簡(jiǎn)單,但它仍然可以一個(gè)強(qiáng)大的工具,下面這篇文章主要給大家介紹了關(guān)于Python?matplotlib繪圖時(shí)使用鼠標(biāo)滾輪放大/縮小圖像的相關(guān)資料,需要的朋友可以參考下
    2022-05-05
  • python讀取當(dāng)前目錄下的CSV文件數(shù)據(jù)

    python讀取當(dāng)前目錄下的CSV文件數(shù)據(jù)

    這篇文章主要為大家詳細(xì)介紹了python讀取當(dāng)前目錄下的CSV文件數(shù)據(jù),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-03-03
  • python中的for循環(huán)

    python中的for循環(huán)

    Python for循環(huán)可以遍歷任何序列的項(xiàng)目,如一個(gè)列表或者一個(gè)字符串。這篇文章主要介紹了python的for循環(huán),需要的朋友可以參考下
    2018-09-09
  • Starship定制shell提示符實(shí)現(xiàn)信息自由

    Starship定制shell提示符實(shí)現(xiàn)信息自由

    這篇文章主要介紹了Starship定制shell提示符的實(shí)現(xiàn),讓你需要的所有信息觸手可及,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-03-03
  • python下載庫(kù)的步驟方法

    python下載庫(kù)的步驟方法

    在本篇文章里小編給大家分享的是關(guān)于python怎么下載庫(kù)的詳細(xì)實(shí)例內(nèi)容,有需要的朋友們學(xué)習(xí)下。
    2019-10-10
  • tensorflow 實(shí)現(xiàn)數(shù)據(jù)類型轉(zhuǎn)換

    tensorflow 實(shí)現(xiàn)數(shù)據(jù)類型轉(zhuǎn)換

    今天小編就為大家分享一篇tensorflow 實(shí)現(xiàn)數(shù)據(jù)類型轉(zhuǎn)換,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2020-02-02
  • python3實(shí)現(xiàn)跳一跳點(diǎn)擊跳躍

    python3實(shí)現(xiàn)跳一跳點(diǎn)擊跳躍

    這篇文章主要為大家詳細(xì)介紹了python3實(shí)現(xiàn)跳一跳點(diǎn)擊跳躍,玩跳一跳小游戲的思路,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-01-01
  • python實(shí)用代碼片段收集貼

    python實(shí)用代碼片段收集貼

    這篇文章主要介紹了python實(shí)用代碼片段收集貼,本文收集了如獲取一個(gè)類的所有子類、計(jì)算運(yùn)行時(shí)間、SQLAlchemy簡(jiǎn)單使用、實(shí)現(xiàn)類似Java或C中的枚舉等實(shí)用功能代碼,需要的朋友可以參考下
    2015-06-06
  • PYTHON如何讀取和寫入EXCEL里面的數(shù)據(jù)

    PYTHON如何讀取和寫入EXCEL里面的數(shù)據(jù)

    這篇文章主要介紹了PYTHON如何讀取和寫入EXCEL里面的數(shù)據(jù),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-10-10
  • 更改Python的pip install 默認(rèn)安裝依賴路徑方法詳解

    更改Python的pip install 默認(rèn)安裝依賴路徑方法詳解

    今天小編就為大家分享一篇更改Python的pip install 默認(rèn)安裝依賴路徑方法詳解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2018-10-10

最新評(píng)論

凉城县| 麻城市| 伊通| 石狮市| 广昌县| 松江区| 资中县| 喜德县| 饶平县| 东乡县| 盐源县| 余干县| 尉氏县| 随州市| 汾阳市| 车致| 寿阳县| 桓台县| 加查县| 尚义县| 渝中区| 廉江市| 宜丰县| 锡林郭勒盟| 鹿泉市| 彭州市| 上栗县| 宝山区| 玉林市| 鄂温| 新蔡县| 乌拉特前旗| 乌鲁木齐县| 科技| 浦北县| 岳普湖县| 都安| 西乡县| 象山县| 特克斯县| 齐齐哈尔市|