欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

plt.subplot()參數(shù)及使用介紹

 更新時(shí)間:2023年01月11日 10:21:27   作者:我是小螞蟻  
本文主要介紹了plt.subplot()參數(shù)及使用介紹,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

plt.subplot()

plt.subplot(nrows, ncols, index, **kwargs)

第一個(gè)參數(shù):*args (官網(wǎng)文檔描述)
Either a 3-digit integer or three separate integers describing the position of the subplot. If the three integers are nrows, ncols, and index in order, the subplot will take the index position on a grid with nrows rows and ncols columns. index starts at 1 in the upper left corner and increases to the right.
可以使用三個(gè)整數(shù),或者三個(gè)獨(dú)立的整數(shù)來描述子圖的位置信息。如果三個(gè)整數(shù)是行數(shù)、列數(shù)和索引值,子圖將分布在行列的索引位置上。索引從1開始,從右上角增加到右下角。
pos is a three digit integer, where the first digit is the number of rows, the second the number of columns, and the third the index of the subplot. i.e. fig.add_subplot(235) is the same as fig.add_subplot(2, 3, 5). Note that all integers must be less than 10 for this form to work.
位置是由三個(gè)整型數(shù)值構(gòu)成,第一個(gè)代表行數(shù),第二個(gè)代表列數(shù),第三個(gè)代表索引位置。舉個(gè)列子:plt.subplot(2, 3, 5) 和 plt.subplot(235) 是一樣一樣的。需要注意的是所有的數(shù)字不能超過10。

第二個(gè)參數(shù):projection : {None, ‘aitoff’, ‘hammer’, ‘lambert’, ‘mollweide’, ‘polar’, ‘rectilinear’, str}, optional
The projection type of the subplot (Axes). str is the name of a costum projection, see projections. The default None results in a ‘rectilinear’ projection.
可選參數(shù):可以選擇子圖的類型,比如選擇polar,就是一個(gè)極點(diǎn)圖。默認(rèn)是none就是一個(gè)線形圖。

第三個(gè)參數(shù):polar : boolean, optional
If True, equivalent to projection=‘polar’. 如果選擇true,就是一個(gè)極點(diǎn)圖,上一個(gè)參數(shù)也能實(shí)現(xiàn)該功能。
官方文檔傳送門:plt.subplot()

import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(1, 2, 2)
y1 = np.sin(x)

y2 = np.cos(x)

ax1 = plt.subplot(2, 2, 1, frameon = False) # 兩行一列,位置是1的子圖
plt.plot(x, y1, 'b--')
plt.ylabel('y1')
ax2 = plt.subplot(2, 2, 2, projection = 'polar')
plt.plot(x, y2, 'r--')
plt.ylabel('y2')
plt.xlabel('x')
plt.subplot(2, 2, 3, sharex = ax1, facecolor = 'red')
plt.plot(x, y2, 'r--')
plt.ylabel('y2')

plt.show()

以上代碼畫圖如下:

在這里插入圖片描述

可以看到plt.subplot()可以依次畫出這些子圖,優(yōu)點(diǎn)是簡單明了,缺點(diǎn)是略顯麻煩。

到此這篇關(guān)于詳解pandas中Series()和DataFrame()的區(qū)別與聯(lián)系的文章就介紹到這了,更多相關(guān)pandas Series()和DataFrame()內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Flask學(xué)習(xí)筆記之日志操作配置實(shí)例講解

    Flask學(xué)習(xí)筆記之日志操作配置實(shí)例講解

    這篇文章主要為大家介紹了Flask學(xué)習(xí)筆記之日志操作配置實(shí)例講解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-11-11
  • Python和Go語言的區(qū)別總結(jié)

    Python和Go語言的區(qū)別總結(jié)

    在本篇文章里小編給大家分享了關(guān)于Python和Go語言的區(qū)別相關(guān)知識點(diǎn),需要的朋友們學(xué)習(xí)下。
    2019-02-02
  • 深入淺析Python中l(wèi)ist的復(fù)制及深拷貝與淺拷貝

    深入淺析Python中l(wèi)ist的復(fù)制及深拷貝與淺拷貝

    這篇文章主要介紹了Python中l(wèi)ist的復(fù)制及深拷貝與淺拷貝及區(qū)別解析 ,需要的朋友可以參考下
    2018-09-09
  • Python和Matlab實(shí)現(xiàn)蝙蝠算法的示例代碼

    Python和Matlab實(shí)現(xiàn)蝙蝠算法的示例代碼

    蝙蝠算法是一種搜索全局最優(yōu)解的有效方法,本文主要介紹了Python和Matlab實(shí)現(xiàn)蝙蝠算法的示例代碼,文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-03-03
  • Python實(shí)現(xiàn)xml格式轉(zhuǎn)txt格式的示例代碼

    Python實(shí)現(xiàn)xml格式轉(zhuǎn)txt格式的示例代碼

    VOC 的標(biāo)注是xml格式的,而YOLO是.txt格式,所以要實(shí)現(xiàn)VOC數(shù)據(jù)集轉(zhuǎn)YOLO數(shù)據(jù)集,只能利用代碼實(shí)現(xiàn)。所以本文為大家介紹了Python中xml轉(zhuǎn)txt的示例代碼,需要的可以參考一下
    2022-03-03
  • python分割一個(gè)文本為多個(gè)文本的方法

    python分割一個(gè)文本為多個(gè)文本的方法

    這篇文章主要為大家詳細(xì)介紹了python分割一個(gè)文本為多個(gè)文本,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2019-07-07
  • Python異步操作MySQL示例【使用aiomysql】

    Python異步操作MySQL示例【使用aiomysql】

    這篇文章主要介紹了Python異步操作MySQL,結(jié)合實(shí)例形式分析了Python安裝及使用aiomysql針對mysql數(shù)據(jù)庫異步操作相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下
    2019-05-05
  • scrapy頭部修改的方法詳解

    scrapy頭部修改的方法詳解

    這篇文章主要給大家介紹了關(guān)于scrapy頭部修改的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-12-12
  • 深入淺析Python代碼規(guī)范性檢測

    深入淺析Python代碼規(guī)范性檢測

    這篇文章主要介紹了Python代碼規(guī)范性檢測,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-07-07
  • Python實(shí)現(xiàn)好友全頭像的拼接實(shí)例(推薦)

    Python實(shí)現(xiàn)好友全頭像的拼接實(shí)例(推薦)

    下面小編就為大家?guī)硪黄狿ython實(shí)現(xiàn)好友全頭像的拼接實(shí)例(推薦)。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2017-06-06

最新評論