1. 程式人生 > >matplotlib改變colorbar位置和方向

matplotlib改變colorbar位置和方向

#! usr/bin/python
#coding=utf-8 
import numpy as np
import matplotlib.pyplot as plt 
data=np.random.rand(10,10)
fig, ax=plt.subplots()
data[data==-1]=np.nan#去掉預設值-1
im =ax.imshow(data,interpolation='none',cmap='Reds_r',vmin=0.6,vmax=.9)#不插值
#去掉邊框
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['bottom'].set_visible(False)
ax.spines['left'].set_visible(False)
########################################################################
position=fig.add_axes([0.15, 0.05, 0.7, 0.03])#位置[左,下,右,上]
cb=plt.colorbar(im,cax=position,orientation='horizontal')#方向

相關推薦

matplotlib改變colorbar位置方向

#! usr/bin/python #coding=utf-8 import numpy as np import matplotlib.pyplot as plt data=np.random.rand(10,10) fig, ax=plt.subplots() da

【PyQt5】(02)改變窗體的位置大小

blank font .com python core www. geo target elf 特別說明 為了直接展示本篇的重點,往期內容將不再寫入代碼中,讀者可按需自行編碼組合 為了更好的展示效果,代碼段將以圖片的形式上傳,若想復制代碼可移步筆者的Github 為了便於

Qt-QComboBox改變顯示方式位置

setView 設定combobox的顯示視窗,並且設定tableview的選中項為當前顯示項 ui->comboBox->setModel(model); QTableView *tableView = new QTableView; tableView-&

VC中自動改變控制元件位置大小的對話方塊類

lxDialog.h檔案: ///////////////////////////////////////////////////////////////////////////////////// // 自動改變控制元件位置和大小的對話方塊類 // 檔名:lxDialog.h //

echarts餅圖角度起始角度位置生長方向

想改變餅圖生長起始角度,用startAngle屬性,但是找不到餅圖的起始位置和生長方向,研究半天終於找到了 舉個栗子 資料: series: [{ name:‘專案’, type:‘pie’, radius: [‘32%’, ‘50%’], minAngle:

QTabWidget 改變tabBar位置改變文字方向

起因     QTabWidget預設的tabBar在最上端。 改進     但有時需要將tabBar放置在左側,但是設定後效果如下… 最終     有時候需要如下效果,則需要自定義style: 附相應程式碼(具體邊框可通過sty

C# Winform 一個可以用滑鼠改變控制元件位置大小的類,直接呼叫即可.....(程式碼收藏)

using System;   using System.Collections.Generic;   using System.Text;   using System.ComponentModel;   using System.Data;   using System.

android 動態改變控制元件位置大小

動態改變控制元件位置的方法: setPadding()的方法更改佈局位置。 如我要把Imageview下移200px:             ImageView.setPadding( ImageView.getPaddingLeft(),  ImageView.get

C#當窗體大小改變時,控制元件的位置大小隨之改變

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.For

window中location物件改變瀏覽器URL位置

window.location可以簡寫為location 1.開啟一個新的url,並在瀏覽器的歷史中生成一條記錄: location.assign('http://www.baidu.com/'

執行時動態移動控制元件的位置改變控制元件的尺寸

Delphi的TCustomForm留有一個為IDE的視覺化設計的用的介面Designer. Designer是IDesignerNotify, IDesignerHook 介面. 我在這裡實現了這些介面. 程式不用做任何改動,只要調函式BeginDesign就可以開始像I

CreateProcess StartupInfo 改變外部程式視窗的起始位置大小

 var  zAppName:array[0..512]   of   char;  zCurDir:array[0..255]   of   char;  WorkDir:String;  StartupInfo:TStartupInfo;  ProcessInfo:TPr

改變對話框控件的背景及文本顏色

文件夾 png desire urn idc line 行程 msg odt WM_CTLCOLOR,響應函數:CWnd::OnCtlColor   afx_msg HBRUSH OnCtlColor(     CDC* pDC, //當前要繪制的控件的設備上下文的指針

springmvc.xml文件的位置命名

文件 blog img 位置 log cnblogs 文件的 pat 物理 一般情況下,需要在web.xml中進行如下配置: springmvc.xml的文件目錄是:classpath:springmvc.xml,物理文件位置: 上面是通常意義的做法,其實還可以

kafka 消費者offset記錄位置方式

inter size als 設置 zookeeper least partition tor topic 我們大家都知道,kafka消費者在會保存其消費的進度,也就是offset,存儲的位置根據選用的kafka api不同而不同。 首先來說說消費者如果是根據javaa

2013年,徹底改變了BAT中國互聯網

技術百度裁撤福州研究中心,並不讓人感到意外。2013年,移動互聯網大潮開始,苦於缺少移動互聯網“船票”的百度被追著趕著以19億美元的天價押寶了“91無線”,91無線旗下的主打產品當屬91手機助手,其時在移動分發市場奪得頭名。四年過後,移動分發市場BTA和360“四足鼎力”,背後還有小米、華為等手機廠商在追趕,

css選擇器位置數量技巧

clas 以及 code blog color 和數 ble 子元素 child 1. 除去首個元素 li:not(:first-child) li + li li:first-child ~ li 2. 第1-3個元素 li:nth-child(-n+3) 3.

快捷位置尺寸

nth 兼容 span 分享 數據 尺寸 div tel 自己的 一、DOM語句提供給我們計算後樣式,但是還是覺得不太方便,因為通過計算後的樣式得到的屬性值都是字符串格式,不能直接參與程序計算。 所以DOM又提供了一些API:得到的是number類型的數據,是可以直接進行計

使用html元素的getBoundingClientRect來獲取dom元素的時時位置大小

html 可能 .get dom元素 logs query htm images cli 使用: var section = $(‘.section‘);這是jquery包裝的dom元素,其他前端框架返回的可能也是一個包裝元素, 我們需要獲得的是裏面的html的dom元素

按鈕相關屬性設置(按鈕文字位置 圖片位置設置)

idt target cal sta brush 位置 icontrol tle 屬性 - (UIButton *)navSearBtn { if (!_navSearBtn) { _navSearBtn = [[UIButton alloc]in