日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python 子图大小_Python | 图的大小

發布時間:2023/12/1 python 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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)

2)高地 (2) Tall Plot)

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

4)方形圖 (4) Square Figure)

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

# Data Visualization using Python # Figure Sizeimport numpy as np import matplotlib.pyplot as pltx = 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 子圖大小

總結

以上是生活随笔為你收集整理的python 子图大小_Python | 图的大小的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。