python畫圖時設置分辨率和畫布大小的實現(xiàn)(plt.figure())
本文介紹了python畫圖時設置分辨率和畫布大小的實現(xiàn),主要使用plt.figure(),下面就一起來了解一下
plt.figure()示例:
import numpy as npimport pandas as pdimport warningswarnings.filterwarnings(’ignore’)import matplotlib.pyplot as pltimport seaborn as sns#讀取示例數(shù)據(jù)df = pd.read_csv( ’https://labfile.oss.aliyuncs.com/courses/1283/telecom_churn.csv’)#sns.countplot(x=’State’, hue=’Churn’, data=df)#畫分布圖sns.countplot(x=df[’State’], hue=df[’Churn’])
調整后:
# 分辨率參數(shù)-dpi,畫布大小參數(shù)-figsizeplt.figure(dpi=300,figsize=(24,8))# 改變文字大小參數(shù)-fontsizeplt.xticks(fontsize=10)#畫分布圖sns.countplot(x=df[’State’], hue=df[’Churn’])
到此這篇關于python畫圖時設置分辨率和畫布大小的實現(xiàn)(plt.figure())的文章就介紹到這了,更多相關python 設置分辨率和畫布內容請搜索好吧啦網以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持好吧啦網!
相關文章: