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

python繪制分組對(duì)比柱狀圖

 更新時(shí)間:2022年04月21日 11:12:44   作者:cejutue  
這篇文章主要為大家詳細(xì)介紹了python繪制分組對(duì)比柱狀圖,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了python繪制分組對(duì)比柱狀圖的具體代碼,供大家參考,具體內(nèi)容如下

首先放效果圖: 

?# -*- coding: utf-8 -*-
import numpy as np
?
import tensorflow as tf
from matplotlib.path import Path
from matplotlib.patches import PathPatch
import matplotlib.pyplot as plt
import matplotlib
from matplotlib.animation import FuncAnimation
import matplotlib as mpl
import datetime
import time
import ?re
import urllib.request
np.set_printoptions(suppress=True)
?
mpl.rcParams['font.sans-serif'] = ['SimHei'] #指定默認(rèn)字體 SimHei為黑體
mpl.rcParams['axes.unicode_minus'] = False #用來(lái)正常顯示負(fù)
import requests
import re
import hashlib
?
#測(cè)試數(shù)據(jù) ?osm的點(diǎn)線面數(shù)據(jù)
#測(cè)試主機(jī) 8G 4核 1T機(jī)械盤
#mysql 5.7.23
#postgresql 12
#dameng 7
#oracle 19c 19.3
?
?
#讀取效率 點(diǎn) ? ? ? ? ? ? 線 ? ? ? ? ? 面
r = [ ? ? [24714, ? ? ? 21748,?? ? ? ?19298], ? ? #Oracle
? ? ? ? ? [44127, ? ? ? 45943,?? ? ? ?42199], ? ? #GDB
? ? ? ? ? #[0, ? ? ?0,?? ??? ?0], ? ?#SQLITE
? ? ? ? ?# [0, ? ? ?0,?? ? ? ?0], ? ?#MySQL
? ? ? ? ? [352641, ? ? ?352739,?? ??? ?304189], ? ?#SQLITE
? ? ? ? ? [213550, ? ? ?218095,?? ? ? ?212749], ? ?#MySQL
? ? ? ? ? [36556, ? ? ? 22172,?? ??? ?12741], ? ? #PostgreSQL
? ? ? ? ? [52749, ? ? ? 46292,?? ??? ?20040], ? ? #dameng
? ? ? ? ? [25111, ? ? ? 12000,?? ? ? ?11000], ? ? #ArcGIS_GDB
? ? ? ? ? [10102, ? ? ? 9003,?? ??? ?7003] ? ? ? #ArcGIS_ORACLE
? ? ?]
?#寫入效率
w = [ ? ? [190, ? ? ? ? 675,?? ??? ?40], ? ? ? ?#Oracle
? ? ? ? ? [15815, ? ? ? 9820,?? ??? ?11892], ? ? #GDB
? ? ? ? ? [94547, ? ? ? 81847,?? ? ? ?57235], ? ? #SQLITE
? ? ? ? ? # [0, ? ? ? 0,?? ? ? ?0], ? ? #SQLITE
? ? ? ? ?[502, ? ? ? ? 662,?? ??? ?403], ? ? ? #MySQL
? ? ? ? ? #[0, ? ? ? ? 0,?? ??? ?0], ? ? ? #MySQL
? ? ? ? ? [1631, ? ? ? ?1599,?? ??? ?1502], ? ? ?#PostgreSQL
? ? ? ? ? [2004, ? ? ? ?1849,?? ??? ?1524], ? ? ?#dameng
? ? ? ? ? [10111, ? ? ? 8000,?? ??? ?5600] , ? ? #ArcGIS_GDB
? ? ? ? ? [1100, ? ? ? 1000,?? ??? ?900] ? ? ? ?#ArcGIS_ORACLE
? ? ] ? ? ?
#這是柱圖x軸標(biāo)簽
ysr = ['Oracle','GDB','SQLITE','MySQL','PostgreSQL','DAMENG','ArcGIS_GDB','ArcGIS_ORACLE'] ?
?
?
def DrawGeoDtaabse(rcount, wcount, y):
? ? #第一行 第一列圖形 ? 2,1 代表2行1列
? ? ax1 = plt.subplot(2,1,1)
? ? #第二行 第一列圖形?
? ? ax3 = plt.subplot(2,1,2)
? ? #默認(rèn)時(shí)間格式
? ? plt.sca(ax1)
? ? plt.xlabel("",color = 'r') #X軸標(biāo)簽
? ? plt.ylabel("條/s",color = 'r') ?#Y軸標(biāo)簽
? ? #plt.grid(True) ? 顯示格網(wǎng)
? ? #plt.gcf().autofmt_xdate() 顯示時(shí)間
? ? plt.legend() # 顯示圖例
? ? plt.title("[讀取]效率") #標(biāo)題
?
? ? x1 = [1,5,9,13,17,21,25,29] # x軸點(diǎn)效率位置
? ? x2 = [i + 1 for i in x1] ? ?# x軸線效率位置
? ? x3 = [i + 2 for i in x1] ? ?# x軸面效率位置
? ? y1 = [i[0] for i in rcount] # y軸點(diǎn)效率位置
? ? y2 = [i[1] for i in rcount] # y軸線效率位置
? ? y3 = [i[2] for i in rcount] # y軸面效率位置
? ? #占位以免 數(shù)據(jù)源標(biāo)簽丟失
? ? y0 = ["","","","","","","",""]
? ? plt.bar(x1, y1, alpha=0.7, width=1, color='r',label="點(diǎn)", tick_label=y0)
? ? plt.bar(x3, y3, alpha=0.7, width=1, color='b',label="面", tick_label=y0)
? ? plt.bar(x2, y2, alpha=0.7, width=1, color='g',label="線", tick_label=y)
? ? #至此第一行的讀取效率繪制完畢,再重復(fù)一下第二行的寫效率
?
? ? plt.sca(ax3)
? ? plt.xlabel("數(shù)據(jù)源",color = 'r') #X軸標(biāo)簽
? ? plt.ylabel("條/s",color = 'r') #Y軸標(biāo)簽
? ? #plt.grid(True)
? ? plt.legend() # 顯示圖例
? ? plt.title("[寫入]效率") #圖標(biāo)題
?
?
? ? y1 = [i[0] for i in wcount]
? ? y2 = [i[1] for i in wcount]
? ? y3 = [i[2] for i in wcount]
? ? y0 = ["","","","","","","",""]
? ? plt.bar(x1, y1, alpha=0.7, width=0.6, color='r',label="點(diǎn)", tick_label=y0)
? ? plt.bar(x3, y3, alpha=0.7, width=0.6, color='b',label="面", tick_label=y0)
? ? plt.bar(x2, y2, alpha=0.7, width=0.6, color='g',label="線", tick_label=y)
?
? ? plt.legend()
? ? plt.show()?
?
DrawGeoDtaabse(r,w,ysr)

以上所有代碼在python3.6.4上運(yùn)行測(cè)試成功

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • python判斷計(jì)算機(jī)是否有網(wǎng)絡(luò)連接的實(shí)例

    python判斷計(jì)算機(jī)是否有網(wǎng)絡(luò)連接的實(shí)例

    今天小編就為大家分享一篇python判斷計(jì)算機(jī)是否有網(wǎng)絡(luò)連接的實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2018-12-12
  • python如何禁用print輸出

    python如何禁用print輸出

    這篇文章主要介紹了python如何禁用print輸出問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-02-02
  • 使用python實(shí)現(xiàn)excel的Vlookup功能

    使用python實(shí)現(xiàn)excel的Vlookup功能

    這篇文章主要介紹了使用python實(shí)現(xiàn)excel的Vlookup功能,當(dāng)我們想要查找的數(shù)據(jù)量較大時(shí),這時(shí)則有請(qǐng)我們的主角VLookup函數(shù)出場(chǎng),那么如何用python實(shí)現(xiàn)VLookup呢,需要的朋友可以參考下
    2023-04-04
  • Python進(jìn)制轉(zhuǎn)換用法詳解

    Python進(jìn)制轉(zhuǎn)換用法詳解

    大家好,本篇文章主要講的是Python進(jìn)制轉(zhuǎn)換用法詳解,感興趣的同學(xué)趕快來(lái)看一看吧,對(duì)你有幫助的話記得收藏一下
    2022-01-01
  • Python處理文本文件中控制字符的方法

    Python處理文本文件中控制字符的方法

    最近在使用Python的時(shí)候遇到過(guò)文檔中出現(xiàn)控制字符報(bào)錯(cuò)的問題。想著總結(jié)一下,方便以后需要或這同樣遇到問題的朋友,下面這篇文章主要介紹了Python處理文本文件中控制字符的解決方法,需要的朋友可以參考借鑒。
    2017-02-02
  • python實(shí)現(xiàn)ftp文件傳輸系統(tǒng)(案例分析)

    python實(shí)現(xiàn)ftp文件傳輸系統(tǒng)(案例分析)

    最近做了一個(gè)簡(jiǎn)單的文件傳輸系統(tǒng),基于ftp協(xié)議,使用python語(yǔ)言開發(fā),雖然python里面已經(jīng)有ftplib模塊,可以很容易的實(shí)現(xiàn)ftp服務(wù)器,這篇文章主要介紹了python實(shí)現(xiàn)ftp文件傳輸系統(tǒng)的案例分析,需要的朋友可以參考下
    2020-03-03
  • Python之串口收發(fā)的異步程序

    Python之串口收發(fā)的異步程序

    這篇文章主要介紹了Python之串口收發(fā)的異步程序,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-09-09
  • python中l(wèi)ist.copy方法用法詳解

    python中l(wèi)ist.copy方法用法詳解

    這篇文章主要給大家介紹了關(guān)于python中l(wèi)ist.copy方法使用的相關(guān)資料,文中還介紹了python?list.copy()?和?copy.deepcopy()區(qū)別,需要的朋友可以參考下
    2023-02-02
  • python實(shí)現(xiàn)ID3決策樹算法

    python實(shí)現(xiàn)ID3決策樹算法

    這篇文章主要為大家詳細(xì)介紹了python實(shí)現(xiàn)ID3決策樹算法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-12-12
  • 詳解Python中的Array模塊

    詳解Python中的Array模塊

    這篇文章主要介紹了詳解Python中的Array模塊,Python中的array模塊是一個(gè)預(yù)定義的數(shù)組,因此其在內(nèi)存中占用的空間比標(biāo)準(zhǔn)列表小得多,同時(shí)也可以執(zhí)行快速的元素級(jí)別操作,例如添加、刪除、索引和切片等操作,需要的朋友可以參考下
    2023-04-04

最新評(píng)論