<kbd id="9plqc"><label id="9plqc"></label></kbd>

        <th id="9plqc"></th>
        1. <center id="9plqc"><video id="9plqc"></video></center>
          <sub id="9plqc"><form id="9plqc"><pre id="9plqc"></pre></form></sub>
          <nav id="9plqc"><form id="9plqc"><legend id="9plqc"></legend></form></nav>
          Python matplotlib 畫圖 字體、字體大小、字體粗細(xì)、文字方向、斜體、旋轉(zhuǎn)角度 全集 您所在的位置:網(wǎng)站首頁 屬馬男與屬馬女 Python matplotlib 畫圖 字體、字體大小、字體粗細(xì)、文字方向、斜體、旋轉(zhuǎn)角度 全集

          Python matplotlib 畫圖 字體、字體大小、字體粗細(xì)、文字方向、斜體、旋轉(zhuǎn)角度 全集

          2023-07-12 03:24| 來源: 網(wǎng)絡(luò)整理| 查看: 265

          Python matplotlib 畫圖 字體、字體大小、字體粗細(xì)、文字方向、斜體 統(tǒng)一設(shè)置 單獨設(shè)置 設(shè)置字體 font 設(shè)置坐標(biāo)軸 axes 字體大小 labelsize 設(shè)置標(biāo)簽 tick 字體大小 labelsize

          設(shè)置坐標(biāo)軸 axes 字體粗細(xì) labelweight 設(shè)置標(biāo)簽 tick 字體粗細(xì) labelweight 可選粗細(xì)有 ['light','normal','medium','semibold','bold','heavy','black'] 可選樣式 ['normal','italic','oblique']

          旋轉(zhuǎn)角度 rotation

          1. 全局設(shè)置方式一 from proplot import rc import matplotlib.pyplot as plt # 統(tǒng)一設(shè)置 from proplot import rc # 統(tǒng)一設(shè)置字體 rc["font.family"] = "TeX Gyre Schola" # 統(tǒng)一設(shè)置軸刻度標(biāo)簽的字體大小 rc['tick.labelsize'] = 10 # 統(tǒng)一設(shè)置xy軸名稱的字體大小 rc["axes.labelsize"] = 20 # 統(tǒng)一設(shè)置軸刻度標(biāo)簽的字體粗細(xì) rc["axes.labelweight"] = "light" # 統(tǒng)一設(shè)置xy軸名稱的字體粗細(xì) rc["tick.labelweight"] = "bold" fig,axes = plt.subplots(1,1,figsize=(4,4),dpi=100,facecolor="w") fig.subplots_adjust(left=0.2,bottom=0.2) axes.set_xlabel('X') axes.set_ylabel('Y')

          在這里插入圖片描述

          2. 全局設(shè)置方式二 # 設(shè)置西文字體為新羅馬字體 from matplotlib import rcParams config = { "font.family":'Times New Roman', # 設(shè)置字體類型 "axes.unicode_minus": False #解決負(fù)號無法顯示的問題 } rcParams.update(config) 3. 單獨設(shè)置 import matplotlib.pyplot as plt fig,axes = plt.subplots(1,1,figsize=(4,4),dpi=100,facecolor="w") #調(diào)整圖的四周間距 fig.subplots_adjust(left=0.2,bottom=0.2) # 單獨設(shè)置軸刻度標(biāo)簽的字體 # axis {'x', 'y', 'both'}, default: 'both' # which {'major', 'minor', 'both'}, default: 'major' axes.tick_params(axis='x', labelsize=18) xlabel_font = { #'fontsize': rcParams['axes.titlesize'], # 設(shè)置成和軸刻度標(biāo)簽一樣的大小 'fontsize': 30, #'fontweight': rcParams['axes.titleweight'], # 設(shè)置成和軸刻度標(biāo)簽一樣的粗細(xì) 'fontweight': 'light', #'color': rcParams['axes.titlecolor'], # 設(shè)置成和軸刻度標(biāo)簽一樣的顏色 'color': 'blue', } # fontdict 設(shè)置字體的相關(guān)屬性 # labelpad 設(shè)置軸名稱到軸的間距 # loc 設(shè)置x軸是靠那邊對其 axes.set_xlabel('x', fontdict=xlabel_font,labelpad=20,loc='right') ylabel_font = { #'fontsize': rcParams['axes.titlesize'], # 設(shè)置成和軸刻度標(biāo)簽一樣的大小 'fontsize': 30, #'fontweight': rcParams['axes.titleweight'], # 設(shè)置成和軸刻度標(biāo)簽一樣的粗細(xì) 'fontweight': 'bold', #'color': rcParams['axes.titlecolor'], # 設(shè)置成和軸刻度標(biāo)簽一樣的顏色 'color': 'red', } axes.set_ylabel('y',fontdict=ylabel_font,labelpad=0) label_fontdict = { 'fontsize': 20, } axes.set_title('title', fontdict=label_fontdict, loc='left', pad=10) # 文字方向 rotation plt.text(0.3, 0.3, 'matplotlib', rotation=180) # 也可以單獨修改, font={ 'style': "italic", 'weight': "normal", 'fontsize':20 } # 設(shè)置字體樣式 plt.text(0.5, 0.5,'matplotlib', fontdict=font)

          在這里插入圖片描述

          # 常用 Times New Roman '''中文字體''' 黑體:SimHei 微軟雅黑:Microsoft YaHei 微軟正黑體:Microsoft JhengHei 新宋體:NSimSun 新細(xì)明體:PMingLiU 細(xì)明體:MingLiU 華文新魏:STXinwei 華文行楷:STXingkai 華文隸書:STLliti 花紋琥珀:STHupo 華文彩云:STCaiyun 方正姚體:FZYaoti 方正舒體:FZShuTi 標(biāo)楷體:DFKai-SB 華文仿宋:STFangsong 華文中宋:STZhongsong 華文宋體:STSong 華文楷體:STKaiti 華文細(xì)黑:STXihei 幼圓:YouYuan 隸書:LiSu 楷體_GB 2313:Kaiti_GB2313 仿宋_GB2313:FangSong_GB2313 仿宋:FangSong


          【本文地址】

          公司簡介

          聯(lián)系我們

          今日新聞

          推薦新聞

          專題文章
            CopyRight 2018-2019 實驗室設(shè)備網(wǎng) 版權(quán)所有
            黄色免费网站在线看,韩国精品在线观看,韩国美女一区二区,99国产热 阿坝| 开阳县| 阿克陶县| 广昌县| 同仁县| 石景山区| 杨浦区| 阜城县| 镇康县| 保靖县| 永川市| 贵港市| 平度市| 清徐县| 三台县| 咸丰县| 拜城县| 北票市| 日土县| 达州市| 溧阳市| 聂荣县| 高阳县| 樟树市| 海阳市| 石首市| 汉源县| 红原县| 雅安市| 礼泉县| 天水市| 邹平县| 自治县| 合阳县| 伊通| 易门县| 商洛市| 庆城县| 雷州市| 乌拉特后旗| 木兰县| http://444 http://444 http://444 http://444 http://444 http://444