python 子圖大小_Python | 圖的大小

python 子圖大小

In some cases, the automatic figure size generated by the matplotlib.pyplot is not visually good or there could be some non-acceptable ratio in the figure. So, rather than allowing a pyplot to decide the figure size, we can manually define the dimensions of the figure.

在某些情況下,由matplotlib.pyplot生成的自動圖形大小在視覺上不佳,或者圖形中可能存在某些不可接受的比例。 因此,我們可以手動定義圖形的尺寸,而不是允許pyplot來確定圖形的尺寸。

In this article, we are going to change figure size using an inbuilt function:

在本文中,我們將使用內置函數更改圖形大小

matplotlib.pyplot.figure(figsize)

Syntax:

句法:

matplotlib.pyplot.figure(figsize=(9,3))
# figsize(float, float)
width, height in inches.

1)寬身材 (1) Wide Figure)

Python | Figure Size of Plot (1)

2)高地 (2) Tall Plot)

Python | Figure Size of Plot (2)

3)小方形圖 (3) Small Square Figure)

Python | Figure Size of Plot (3)

4)方形圖 (4) Square Figure)

Python | Figure Size of Plot (4)

繪圖圖形大小的Python代碼 (Python code for figure size of plot)

# Data Visualization using Python
# Figure Size
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(50)
y = 2*x*x + 7*x - 14
# Example 1 
plt.figure(figsize=(9,5))
# Leftmost
plt.plot(x, y, 'yo')
plt.title('Plot')
plt.ylabel('Function Vaule')
plt.xlabel('x-axis')
plt.show()
# Example 2 
plt.figure(figsize=(6,9))
# Leftmost
plt.plot(x, y, 'yo')
plt.title('Plot')
plt.ylabel('Function Vaule')
plt.xlabel('x-axis')
plt.show()
# Example 3
plt.figure(figsize=(3,3))
# Leftmost
plt.plot(x, y, 'yo')
plt.title('Plot')
plt.ylabel('Function Vaule')
plt.xlabel('x-axis')
plt.show()
# Example 4 
plt.figure(figsize=(7,7))
# Leftmost
plt.plot(x, y, 'yo')
plt.title('Plot')
plt.ylabel('Function Vaule')
plt.xlabel('x-axis')
plt.show()

Output:

輸出:

Output is as figure

翻譯自: https://www.includehelp.com/python/figure-size-of-plot.aspx

python 子圖大小

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/377280.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/377280.shtml
英文地址,請注明出處:http://en.pswp.cn/news/377280.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

《設計模式整理》

目錄常見設計模式如何保證單例模式只有一個實例單例模式中的懶漢與餓漢模式OOP設計模式的五項原則單例模式中的懶漢加載,如果并發訪問該怎么做常見設計模式 單例模式: 單例模式主要解決了一個全局使用的類頻繁的創建和銷毀的問題。 單例模式下確保某一個…

JSON學習資料整理

1.什么是JSON JSON(JavaScript Object Notation) 是一種輕量級的數據交換格式。它基于JavaScript的一個子集。 JSON采用完全獨立于語言的文本格式,但是也使用了類似于C語言家族的習慣(包括C, C, C#, Java, JavaScript, Perl, Python等)。這些…

OSI七層模型及其數據的封裝和解封過程

OSI(Open System Interconnection)參考模型把網絡分為七層: 1.物理層(Physical Layer) 物理層主要傳輸原始的比特流,集線器(Hub)是本層的典型設備; 2.數據鏈路層(Data Link Layer) 數據鏈路層負責在兩個相鄰節點間無差錯的傳送以幀為單位的數據,本層的典型設備是交換機(Switch)…

rss聚合模式案例_RSS的完整形式是什么?

rss聚合模式案例RSS:真正簡單的聯合 (RSS: Really Simple Syndication) RSS is an abbreviation of Really Simple Syndication. It is also called Rich Site Summary. It is quality attainment for the syndication of collection of web content and used to di…

《MySQL——38道查詢練習(無連接查詢)》

目錄一、準備數據1、創建數據庫2、創建學生表3、創建教師表4、創建課程表5、創建成績表6、添加數據二、查詢練習1、查詢 student 表的所有行2、查詢 student 表中的 name、sex 和 class 字段的所有行3、查詢 teacher 表中不重復的 department 列4、查詢 score 表中成績在60-80之…

工作經常使用的SQL整理,實戰篇(一)

工作經常使用的SQL整理,實戰篇(一) 原文:工作經常使用的SQL整理,實戰篇(一)工作經常使用的SQL整理,實戰篇,地址一覽: 工作經常使用的SQL整理,實戰篇&#xff…

XPth和XSLT的一些簡單用法

(目的在于讓大家知道有這個東西的存在) XPath:即XML Path語言(Xpath)表達式使用路徑表示法(像在URL中使用一樣)來為XML文檔的各部分尋址! 關于XPath如何使用了,我們來看看!當然這里面的代碼只是入門,更深層…

isc dhcp_ISC的完整形式是什么?

isc dhcpISC:印度學校證書 (ISC: Indian School Certificate) ISC is an abbreviation of the Indian School Certificate. It alludes to the 12th class examination or higher secondary examination conducted by the Council for the Indian School Certificat…

《MySQL——連接查詢》

內連接: inner join 或者 join 外連接 1、左連接 left join 或 left outer join 2、右連接 right join 或 right outer join 3、完全外連接 full join 或 full outer join 圖示理解 全連接 創建person表和card表 CREATE DATABASE testJoin;CREATE TABLE person (…

win7下 apache2.2 +php5.4 環境搭建

這篇文章很好 沒法復制 把鏈接粘貼來http://www.360doc.com/content/13/0506/13/11495619_283349585.shtml# 現在能復制了: 把任何一篇你要復制、卻不讓復制的文章收藏入收藏夾(直接CtrlD,確定) 2在收藏夾中,右擊剛才收藏的那個網址,點屬性 3…

HDU_1533 Going Home(最優匹配) 解題報告

轉載請注明出自cxb:http://blog.csdn.net/cxb569262726 題目鏈接:http://acm.hdu.edu.cn/showproblem.php?pid1533 說實話,這個題目剛開始還真看不出是完備匹配下的最大權匹配(當然,這個也可以用網絡流做。(應該是添加…

c#中 uint_C#中的uint關鍵字

c#中 uintC#uint關鍵字 (C# uint keyword) In C#, uint is a keyword which is used to declare a variable that can store an integral type of value (unsigned integer) the range of 0 to 4,294,967,295. uint keyword is an alias of System.UInt32. 在C&…

《MySQL——事務》

目錄事務的必要性MySQL中如何控制事務手動開啟事務事務的四大特征事務的四大特征事務開啟方式事務手動提交與手動回滾事務的隔離性臟讀現象不可重復讀現象幻讀現象串行化一些補充使用長事務的弊病commit work and chain的語法是做什么用的?怎么查詢各個表中的長事務&#xff1…

運行在TQ2440開發板上以及X86平臺上的linux內核編譯

一、運行在TQ2440開發板上的linux內核編譯 1、獲取源碼并解壓 直接使用天嵌移植好的“linux-2.6.30.4_20100531.tar.bz2”源碼包。 解壓(天嵌默認解壓到/opt/EmbedSky/linux-2.6.30.4/中) tar xvjf linux-2.6.30.4_20100531.tar.bz2 -C / 2、獲取默認配置…

ArcCatalog ArcMap打不開

原來是因為: 連接了電信的無線網卡 關掉即可 啟動ArcCatalog之后再開啟無線網卡 沒問題!轉載于:https://www.cnblogs.com/ccjcjc/archive/2012/08/21/2649867.html

Python熊貓– GroupBy

Python熊貓– GroupBy (Python Pandas – GroupBy) GroupBy method can be used to work on group rows of data together and call aggregate functions. It allows to group together rows based off of a column and perform an aggregate function on them. GroupBy方法可用…

MySQL索引底層原理理解以及常見問題總結

目錄二叉查找樹為索引紅黑樹為索引B樹作為索引B樹作為索引MyISAM存儲引擎索引實現InnoDB存儲引擎索引實現常見問題聚集索引與非聚集索引InnoDB基于主鍵索引和普通索引的查詢有什么區別?InnoDB主鍵索引為何是整型的自增主鍵何時使用業務字段作為主鍵呢?哈…

Spring之HibernateTemplate 和HibernateDaoSupport

spring提供訪問數據庫的有三種方式: HibernateDaoSupport HibernateTemplate(推薦使用) jdbcTemplate(我們一般不用) 類所在包: HibernateTemplate:org.springframework.orm.hibernate3.HibernateTemplate …

JDOJ-重建二叉樹

這是一道面試題,可以說是數據結構中的基礎題了,由先序遍歷以及中序遍歷生成一棵樹,然后輸出后序遍歷。 一個遞歸函數傳遞5個參數,頂點編號,先序左右區間,中序左右區間,每次進行區間長度判定&…

des算法密碼多長_密碼學中的多個DES

des算法密碼多長This is a DES that was susceptible to attacks due to tremendous advances in computer hardware in cryptography. Hence, it was a very complex or competent algorithm it would be feasible to reuse DES rather than writing an of cryptography. 由于…