堆疊條形圖

堆疊條形圖

復制代碼
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import matplotlib.dates as mdates#解決能顯示中文
mpl.rcParams['font.sans-serif']=['SimHei'] #指定默認字體 SimHei為黑體
mpl.rcParams['axes.unicode_minus']=False #用來正常顯示負號plt.title("圖標題",fontsize=24)  #圖的標題
plt.xlabel("x軸標題")
plt.ylabel("y軸標題")#x=[0.0,1.0,2.0,3.0,4.0]
x=np.array([0,1,2,3,4])
y=[10,20,40,30,50]
s=plt.bar(x,height=y,color='r',width=0.2,alpha=0.8)
#參數1  橫坐標位置;參數2 縱坐標高度
#color 設置顏色
#width設置條形圖的寬度
#alpha設置透明度
#題注文本
plt.ylim(0, 60)     # y軸取值范圍

s1=plt.bar(x,height=y,color='b',width=0.2,alpha=0.8,bottom=y)  #堆疊條形圖
#bottom=y  在y條形柱的底部開始畫
plt.show()  #把圖形顯示出來
復制代碼

?

?效果圖

?

轉載于:https://www.cnblogs.com/liming19680104/p/10614123.html

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

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

相關文章

spring boot 服務器常用

ps aux|grep tgcwll /opt/nginx/html sudo cp -r /tmp/tgcw/dist/* /opt/nginx/html/design sudo cp -r /tmp/tgcw/dist/* /opt/nginx/html springboot 啟動nohup java -jar tgcw-service-usermanagement-0.0.1-SNAPSHOT.jar --spring.profiles.activedemo > /dev/null 2&g…

PHP數組 轉 對象/對象 轉 數組

/*** 數組 轉 對象** param array $arr 數組* return object*/ function array_to_object($arr) {if (gettype($arr) ! array) {return;}foreach ($arr as $k > $v) {if (gettype($v) array || getType($v) object) {$arr[$k] (object)array_to_object($v);}}return (obj…

ZooKeeper編程01--RMI服務的多服務器管理

服務器端與客戶端都要用到: public interface ZkInfo {String ZK_CONNECTION_STRING "192.168.1.201:2181,192.168.1.202:2181,192.168.1.203:2181";int ZK_SESSION_TIMEOUT 5000;String ZK_REGISTRY_PATH "/registry";String ZK_PROVIDER_…

org.activiti.engine.ActivitiOptimisticLockingException updated by another transaction concurrently

org.activiti.engine.ActivitiOptimisticLockingException: Task[id5905010, name審核(市場部)] was updated by another transaction concurrentlyat org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:872)at org.activiti.engine.impl.db.DbSqlSess…

DataTable不能通過已刪除的行訪問該行的信息解決方法

使用dt.Rows[0]["name", DataRowVersion.Original]可以獲取轉載于:https://www.cnblogs.com/heyiping/p/10616640.html

ZooKeeper編程02--多線程的分佈式鎖

面向過程版: package distributedLockProcess;import java.util.Collections; import java.util.List; import java.util.concurrent.CountDownLatch;import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException; import org.apache.zoo…

01 Python變量和數據類型

Python變量和數據類型 1 數據類型 計算機,顧名思義就是可以做數學計算的機器,因此,計算機程序理所當然也可以處理各種數值。 但是,計算機能處理的遠不止數值,還可以處理文本、圖形、音頻、視頻、網頁等各種各樣的數…

初識Python-1

1,計算機基礎。 2,python歷史。 宏觀上:python2 與 python3 區別: python2 源碼不標準,混亂,重復代碼太多, python3 統一 標準,去除重復代碼。 3,python的環境。 編譯型&…

02 List、Tuple、Dict、Set

List 線性表 創建List: >>> classmates [Michael, Bob, Tracy] >>> L [Michael, 100, True] #可以在list中包含各種類型的數據 >>> empty_list [] #空List 按索引訪問List: >>> print L[0] #索引從0開始…

Jenkins的一些代碼

pipeline {agent anyenvironment { def ITEMNAME "erp"def DESTPATH "/home/ops/testpipe"def codePATH"/var/lib/jenkins/workspace/test_pipeline"}stages { stage(代碼拉取){steps {echo "checkout from ${ITEMNAME}"git url:…

利用layui前端框架實現對不同文件夾的多文件上傳

利用layui前端框架實現對不同文件夾的多文件上傳 問題場景: 普通的input標簽實現多文件上傳時,只能對同一個文件夾下的多個文件進行上傳,如果要同時上傳兩個或多個文件夾下的文件,是無法實現的。這篇文章就是利用layui中的插件&am…

ps、grep和kill聯合使用殺掉進程

ps、grep和kill聯合使用殺掉進程例如要殺掉hello這個進程,使用下面這個命令就能直接實現。ps -ef |grep hello |awk {print $2}|xargs kill -9這里是輸出ps -ef |grep hello 結果的第二列的內容然后通過xargs傳遞給kill -9,其實第二列內容就是hello的進程號&#xf…

03 控制語句

if語句 if age > 18 print your age is, age else print teenager Python代碼的縮進規則:具有相同縮進的代碼被視為代碼塊。 if age > 18 print adult elif age > 6 print teenager elif age > 3 print kid else print baby for循環 L [Adam, L…

yum 來安裝 nodejs

要通過 yum 來安裝 nodejs 和 npm 需要先給 yum 添加 epel 源,添加方法在 centos 添加epel和remi源 中##添加 epel 源 64位: rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm32位: rpm -ivh http://download.fedoraproj…

yzh的神仙題

U66905 zz題 考慮一個點權值被計算了多少次。。。不知 所以對未來承諾,方便直接算上總數! 然后其實是給邊定向,即先刪除fa和son的哪一個 f[x][j],會計算j次 無法轉移 f[x][j][k],其中會從子樹計算k次。 當邊從兒子指向…

04 函數

內置函數 Python內置了很多有用的函數,可以直接調用。 要調用一個函數,需要知道函數的名稱和參數。 可以直接從Python的官方網站查看文檔:http://docs.python.org/2/library >>> abs(-20) >>> help(abs) >>>…

iview render的時候可以寫控件的基本格式

render: (h, params) > {return h(div, [h(Button, {props: {type: id,size: small},style: {marginRight: 5px},on: {click: () > {this.pojectshow(this.datatable[params.index].id)}}}, 詳情),h(Button, {props: {type: id,size: small},style: {marginRight: 5px},o…

ES6基本使用

var let 度可用于聲明變量. 區別&#xff1a;1、let&#xff1a;只在let命令所在代碼塊內有效 2、let 不存在變量提升&#xff08;內部影響不到外部&#xff09; var b [];for(var j0;j<10;j){let dj;b[j]function(){console.log(d);};}b[3]() //3 3、let 不允許在相同作用…

Axios的Vue插件(添加全局請求/響應攔截器)

/*** file Axios的Vue插件&#xff08;添加全局請求/響應攔截器&#xff09;*/// https://github.com/mzabriskie/axios import axios from axios// 攔截request,設置全局請求為ajax請求 axios.interceptors.request.use((config) > {config.headers[X-Requested-With] XML…

05 切片、迭代、列表生成

切片 >>> L [Adam, Lisa, Bart, Paul] >>> L[0:3] #取前3個元素 >>> L[:3] >>> L[1:3] >>> L[:] >>> L[::2] #第三個參數表示每2個元素取一個元素&#xff0c;也就是隔一個取一個 [Adam,Bart] >>>…