基于python3 bokeh的分类树状图和热图绘制库。

bokehheat的Python项目详细描述


#bokehheat提供了一个python3,基于bokeh,交互式的分类树状图和热图绘制实现。


+最低要求:python3.6
+依赖项:bokeh,pandas,scipy
+程序员:bue,jenny
+日期来源:2018-08
+许可证:>;=gplv3
+用户手册:这个自述文件
+源代码:[https://gitlab.com/biotransitor/bokehheat](https://gitlab.com/biotransitor/bokehheat)

eat.bbar:交互式布尔条形图实现。
+heat.cbar:交互式分类条形图实现。
+heat.qbar:交互式定量条形图实现。
+heat.heatmap:交互式热图实现。
+heat.clustermap:交互式cluster heatmap实现,它将
heat.cdendro、heat.bbar、heat.cbar、heat.qbar和heat.heatmap组合在引擎盖下。

网络浏览器
(我们推荐[firefox](https://www.mozilla.org/en-us/firefox/developer/)。

![heat.clusterMap image](theclusterMap.png)

**图:**这是一个糟糕的静态heat.clusterMap HTML结果屏幕截图。





`` bash
pip3安装bokehheat
```

如何加载bokehheat库?如何获取关于如何使用每个Bokehheat模块的参考信息?
`` python
来自bokehheat import heat

help(heat.bbar)
help(heat.cbar)
help(heat.qbar)
help(heat.heatmap)
help(heat.clustermap)
``

如何将bokehheat图集成到[pweave]中(https://github.com/mpastell/pweave)
文档?
``python
from pweave.bokeh import output懔pweave,show

o懔clusterMap,ls懔xaxis,ls懔yaxis=heat.clusterMap(…)
show(o懔clusterMap)
```

加载本教程所需的库:
``python
library
from bokeh heat import heat
from bokeh.io import show
from bokeh.palettes import reds9,ylgn8,colorbind8
import numpy as np
import pandas as pd
```

1。准备数据:
`` python
`生成测试数据
ls-sample=['sample辩,'sampleb','samplec','samplec','samplee','samplef','sampleg','sampleh']
ls ` `` ls-变量=['genea','genea','geneb','genec','gened','genee','genef'genef'genef','geneg','genea'genea,'geneb'geneb','genec','genec','genec','genenee','genec','genec','gened','genee','genee','genee','genee','genee','genee'
df_matrix=pd.dataframe(ar_z)
df_matrix.index=ls_sample
df_matrix.columns=ls_variable
df_matrix.index.name='y'
df_matrix.columns.name='x'

生成一些示例注释
df sample=pd.dataframe({
'y':ls_sample,
"年龄—年份":列表(np.random.randint(0101,8)),
'sampletype':['luma','luma','luma','lum','lumb','lumb','lumb','base','base','base','base',,
'sampletype'u color',
'sampletype'sampletype'sampletype'sampletype'sampletype'sampletype':['青色,'青色,'青色,'青色,'青蓝,'蓝,'蓝,'蓝,'红色,'红色,'红色,'红色,'红色,'红色,'红色,'红色,'红色,'红色,'红色,'红色,,
>>>}

<>属一些基因注释黄色","黄色","棕色","棕色","棕色",
})
df_variable.index=df_variable.x
````

>1。生成分类定量样本和基因
元组的注释元组这些:
``python
t丼ycat=(df丼sampletype,['sampletype'sampletype'sampletype'sampletype'sampletype'sampletype'sampletype'sampletype'sampletype'sampletype'sampletype'sampletype'color'])
t丼t at=(df at变量,['genetype'genetype'genetype'genetype'genetype'genetype,['genetype'genetype'genetype'genetype'genetype'genetype'genetype'genetype'genetype'genetype'genet)
t t_catquant=(t_ycat,t_yquant,t_xquant,t_xcat)
````


1。生成集群热图:
`` python
s廑file="the clustermap.html"
o廑clustermap,ls廑xaxis,ls廑yaxis=heat.clustermap(
df廑matrix=df廑matrix,
ls廑color廑palette=reds9,
r廑low=0,
r廑high=1,
s廑z="log2",庠庠庠庠庠庠庠庠庠庠庠庠庠庠庠24224;庠庠24224;24224;庠24224;24224;24224;_____2422453;2422453;_filename=s_文件,
s_filetitel="The ClusterMap",

````

>1。显示结果:
``python
print(f"check out:{s_file}")
print(f"y axis:{ls_yaxis}")
print(f"x axis:{ls_xaxis}")

show(o_clustermap)
```
.

讨论

r/index.html)
用于生成和调查此类热图。


来自gplots库的heatmap.2,
每一个都有自己的优缺点。

在python中,静态集群heatmap环境看起来更加冷清。
有一些古老的基于[mathplotlib](https://matplotlib.org/)的实现tivestate.com/recipes/578175分层群集heatmap python/)
或[heatmapcluster]库。
有[seaborn clustermap]实现,
看起来不错,但是可能需要几个小时的调整才能得到一个令人满意的图,其中包含所有需要的信息。


因此,静态热图并不是真正用来探索数据的工具。


ges.
和heatmaply,一个基于r/plotly的软件包。
或者更基本的基于r/plotly的集群热图可以用ggdendro和ggplot2库编写。

//plot.ly/)也不是基于python/[bokeh](https://bokeh.pydata.org/en/latest/)的。
我发现的唯一基于python/bokeh的集群热图实现是这个
[列表](https://russodanielp.github.io/plotting-a-heatmap-with-a-dendrogram-using-bokeh.html)
来自daniel russo。



总之,所有这些实现并不是我真正想要的。
这就是我推出自己的原因。
bokehheat是一个基于python/[bokeh](https://bokeh.pydata.org/en/latest/)的交互式集群热图库。


库应该:
+易于与[pandas]一起使用(https://pandas.pydata.org/)datafarmes。
+交互式,这意味着结果应该是悬停和可缩放的图。
+输出应该是独立于计算机平台且易于访问的。E格式,
类似Java脚本的HTML文件,它可以在任何浏览器中打开。
+的可能性是添加尽可能多的分类和定量的Y和X注释条。
+可能簇Y和/或X轴。样本和基因。
(事实证明Bokehheat可以处理成百上千的样本和基因,但不能处理成千的样本和基因。)

查看jake vanderplas talk
[python可视化景观](https://www.youtube.com/watch?V=FYTUB8NFHPQ)
摘自美国俄勒冈州波特兰市2017年PYCON大会。



+实施:Elmar Bucher
+文件:Jennifer Eng,Elmar Bucher
+帮助讨论:Mark Dane,Daniel Derrick,Hongmei Zhang,
Annette Kolodize,Jim Korkola,Laura Heiser



欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java使用唯一的按钮标签单击按钮   代码生成如何使用Java codeModel为数组的特定索引赋值   java如何批量执行Camel SQL插入   java iText 7将ltv添加到现有签名   内存管理Java应用程序突然停止几天后(810)   带MySQL的java注册表单JavaFX在intellij中失败   如何使用eclipse为windows azure java项目启用远程调试   一种通用的java输入输出设计模式   java Android XML(RSS)忽略引号(“”)   java帮助:安卓中的8 X 10 2维按钮数组   java启动Android项目   JWrapper构建java应用程序   java如何在Android应用程序中设置基于日期/时间的默认页面加载?   java循环程序在完成后返回到起点   java Hibernate:更好的整体类还是多类映射?   回溯数独解算器的递归问题[Java]   java查找类用法   java如何在SpringWebFlow中将多个模型绑定到一个视图?