来源:网络

由下面代码生成 

from chord import Chordmatrix = [[0, 5, 6, 4, 7, 4],[5, 0, 5, 4, 6, 5],[6, 5, 0, 4, 5, 5],[4, 4, 4, 0, 5, 5],[7, 6, 5, 5, 0, 4],[4, 5, 5, 5, 4, 0],
]names = ["Action", "Adventure", "Comedy", "Drama", "Fantasy", "Thriller"]# 保存
Chord(matrix, names).to_html("chord-diagram.html")

图形表现力强悍!

Altair概述

Altair是一个用于Python的声明式统计可视化库,基于Vega和Vega-Lite。

Altair提供了一个强大而简洁的可视化语法,使你能够快速建立一个广泛的统计可视化。下面是一个使用Altair API的例子,通过一个交互式散点图快速实现数据集的可视化。

Github:

https://altair-viz.github.io/getting_started/overview.html

表现强悍

图形表现力强悍!

import matplotlib.pyplot as plt# 创建数据
size_of_groups = [12, 11, 3, 30]# 生成饼图
plt.pie(size_of_groups)# 在中心添加一个圆, 生成环形图
my_circle = plt.Circle((0, 0), 0.7, color='white')
p = plt.gcf()
p.gca().add_artist(my_circle)plt.show()

image.png

import matplotlib.pyplot as plt
from matplotlib_venn import venn2# 创建图表
venn2(subsets=(10, 5, 2), set_labels=('Group A', 'Group B'))# 显示
plt.show()

image.png

import circlify
import matplotlib.pyplot as plt# 创建画布, 包含一个子图
fig, ax = plt.subplots(figsize=(14, 14))# 标题
ax.set_title('Repartition of the world population')# 移除坐标轴
ax.axis('off')# 人口数据
data = [{'id': 'World', 'datum': 6964195249, 'children': [{'id': "North America", 'datum': 450448697,'children': [{'id': "United States", 'datum': 308865000},{'id': "Mexico", 'datum': 107550697},{'id': "Canada", 'datum': 34033000}]},{'id': "South America", 'datum': 278095425,'children': [{'id': "Brazil", 'datum': 192612000},{'id': "Colombia", 'datum': 45349000},{'id': "Argentina", 'datum': 40134425}]},{'id': "Europe", 'datum': 209246682,'children': [{'id': "Germany", 'datum': 81757600},{'id': "France", 'datum': 65447374},{'id': "United Kingdom", 'datum': 62041708}]},{'id': "Africa", 'datum': 311929000,'children': [{'id': "Nigeria", 'datum': 154729000},{'id': "Ethiopia", 'datum': 79221000},{'id': "Egypt", 'datum': 77979000}]},{'id': "Asia", 'datum': 2745929500,'children': [{'id': "China", 'datum': 1336335000},{'id': "India", 'datum': 1178225000},{'id': "Indonesia", 'datum': 231369500}]}]}]# 使用circlify()计算, 获取圆的大小, 位置
circles = circlify.circlify(data,show_enclosure=False,target_enclosure=circlify.Circle(x=0, y=0, r=1)
)lim = max(max(abs(circle.x) + circle.r,abs(circle.y) + circle.r,)for circle in circles
)
plt.xlim(-lim, lim)
plt.ylim(-lim, lim)for circle in circles:if circle.level != 2:continuex, y, r = circleax.add_patch(plt.Circle((x, y), r, alpha=0.5, linewidth=2, color="lightblue"))for circle in circles:if circle.level != 3:continuex, y, r = circlelabel = circle.ex["id"]ax.add_patch(plt.Circle((x, y), r, alpha=0.5, linewidth=2, color="#69b3a2"))plt.annotate(label, (x, y), ha='center', color="white")for circle in circles:if circle.level != 2:continuex, y, r = circlelabel = circle.ex["id"]plt.annotate(label, (x, y), va='center', ha='center', bbox=dict(facecolor='white', edgecolor='black', boxstyle='round', pad=.5))plt.show()

image.png

import folium
import pandas as pd# 创建地图对象
m = folium.Map(location=[20,0], tiles="OpenStreetMap", zoom_start=2)# 坐标点数据
data = pd.DataFrame({'lon': [-58, 2, 145, 30.32, -4.03, -73.57, 36.82, -38.5],'lat': [-34, 49, -38, 59.93, 5.33, 45.52, -1.29, -12.97],'name': ['Buenos Aires', 'Paris', 'melbourne', 'St Petersbourg', 'Abidjan', 'Montreal', 'Nairobi', 'Salvador'],'value': [10, 12, 40, 70, 23, 43, 100, 43]
}, dtype=str)# 添加气泡
for i in range(0, len(data)):folium.Circle(location=[data.iloc[i]['lat'], data.iloc[i]['lon']],popup=data.iloc[i]['name'],radius=float(data.iloc[i]['value'])*20000,color='crimson',fill=True,fill_color='crimson').add_to(m)# 保存
m.save('bubble-map.html')

image.png

import altair as alt
from vega_datasets import databoroughs = alt.topo_feature(data.londonBoroughs.url, 'boroughs')
tubelines = alt.topo_feature(data.londonTubeLines.url, 'line')
centroids = data.londonCentroids.urlbackground = alt.Chart(boroughs).mark_geoshape(stroke='white',strokeWidth=2
).encode(color=alt.value('#eee'),
).properties(width=700,height=500
)labels = alt.Chart(centroids).mark_text().encode(longitude='cx:Q',latitude='cy:Q',text='bLabel:N',size=alt.value(8),opacity=alt.value(0.6)
).transform_calculate("bLabel", "indexof (datum.name,' ') > 0  ? substring(datum.name,0,indexof(datum.name, ' ')) : datum.name"
)line_scale = alt.Scale(domain=["Bakerloo", "Central", "Circle", "District", "DLR","Hammersmith & City", "Jubilee", "Metropolitan", "Northern","Piccadilly", "Victoria", "Waterloo & City"],range=["rgb(137,78,36)", "rgb(220,36,30)", "rgb(255,206,0)","rgb(1,114,41)", "rgb(0,175,173)", "rgb(215,153,175)","rgb(106,114,120)", "rgb(114,17,84)", "rgb(0,0,0)","rgb(0,24,168)", "rgb(0,160,226)", "rgb(106,187,170)"])lines = alt.Chart(tubelines).mark_geoshape(filled=False,strokeWidth=2
).encode(alt.Color('id:N',legend=alt.Legend(title=None,orient='bottom-right',offset=0),scale=line_scale)
)background + labels + lines

image.png

import altair as alt
from vega_datasets import datasource = data.disasters.urlalt.Chart(source).mark_circle(opacity=0.8,stroke='black',strokeWidth=1
).encode(alt.X('Year:O', axis=alt.Axis(labelAngle=0)),alt.Y('Entity:N'),alt.Size('Deaths:Q',scale=alt.Scale(range=[0, 4000]),legend=alt.Legend(title='Annual Global Deaths')),alt.Color('Entity:N', legend=None)
).properties(width=450,height=320
).transform_filter(alt.datum.Entity != 'All natural disasters'
)

image.png

import altair as alt
import pandas as pdsource = pd.DataFrame([{'country': 'Great Britain', 'animal': 'cattle'},{'country': 'Great Britain', 'animal': 'cattle'},{'country': 'Great Britain', 'animal': 'cattle'},{'country': 'Great Britain', 'animal': 'pigs'},{'country': 'Great Britain', 'animal': 'pigs'},{'country': 'Great Britain', 'animal': 'sheep'},{'country': 'Great Britain', 'animal': 'sheep'},{'country': 'Great Britain', 'animal': 'sheep'},{'country': 'Great Britain', 'animal': 'sheep'},{'country': 'Great Britain', 'animal': 'sheep'},{'country': 'Great Britain', 'animal': 'sheep'},{'country': 'Great Britain', 'animal': 'sheep'},{'country': 'Great Britain', 'animal': 'sheep'},{'country': 'Great Britain', 'animal': 'sheep'},{'country': 'Great Britain', 'animal': 'sheep'},{'country': 'United States', 'animal': 'cattle'},{'country': 'United States', 'animal': 'cattle'},{'country': 'United States', 'animal': 'cattle'},{'country': 'United States', 'animal': 'cattle'},{'country': 'United States', 'animal': 'cattle'},{'country': 'United States', 'animal': 'cattle'},{'country': 'United States', 'animal': 'cattle'},{'country': 'United States', 'animal': 'cattle'},{'country': 'United States', 'animal': 'cattle'},{'country': 'United States', 'animal': 'pigs'},{'country': 'United States', 'animal': 'pigs'},{'country': 'United States', 'animal': 'pigs'},{'country': 'United States', 'animal': 'pigs'},{'country': 'United States', 'animal': 'pigs'},{'country': 'United States', 'animal': 'pigs'},{'country': 'United States', 'animal': 'sheep'},{'country': 'United States', 'animal': 'sheep'},{'country': 'United States', 'animal': 'sheep'},{'country': 'United States', 'animal': 'sheep'},{'country': 'United States', 'animal': 'sheep'},{'country': 'United States', 'animal': 'sheep'},{'country': 'United States', 'animal': 'sheep'}])domains = ['person', 'cattle', 'pigs', 'sheep']shape_scale = alt.Scale(domain=domains,range=['M1.7 -1.7h-0.8c0.3 -0.2 0.6 -0.5 0.6 -0.9c0 -0.6 -0.4 -1 -1 -1c-0.6 0 -1 0.4 -1 1c0 0.4 0.2 0.7 0.6 0.9h-0.8c-0.4 0 -0.7 0.3 -0.7 0.6v1.9c0 0.3 0.3 0.6 0.6 0.6h0.2c0 0 0 0.1 0 0.1v1.9c0 0.3 0.2 0.6 0.3 0.6h1.3c0.2 0 0.3 -0.3 0.3 -0.6v-1.8c0 0 0 -0.1 0 -0.1h0.2c0.3 0 0.6 -0.3 0.6 -0.6v-2c0.2 -0.3 -0.1 -0.6 -0.4 -0.6z','M4 -2c0 0 0.9 -0.7 1.1 -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c-0.1 0.1 -0.2 0.2 -0.3 0.4c0 0.2 0.1 0.3 0 0.5c-0.1 0.2 -0.3 0.2 -0.3 0.5c0 0.3 -0.2 0.3 -0.3 0.6c-0.1 0.2 0 0.3 -0.1 0.5c-0.1 0.2 -0.1 0.2 -0.2 0.3c-0.1 0.1 0.3 1.1 0.3 1.1l-0.3 0c0 0 -0.3 -0.9 -0.3 -1c0 -0.1 -0.1 -0.2 -0.3 -0.2c-0.2 0 -0.3 0.1 -0.4 0.4c0 0.3 -0.2 0.8 -0.2 0.8l-0.3 0l0.3 -1c0 0 0.1 -0.6 -0.2 -0.5c-0.3 0.1 -0.2 -0.1 -0.4 -0.1c-0.2 -0.1 -0.3 0.1 -0.4 0c-0.2 -0.1 -0.3 0.1 -0.5 0c-0.2 -0.1 -0.1 0 -0.3 0.3c-0.2 0.3 -0.4 0.3 -0.4 0.3l0.2 1.1l-0.3 0l-0.2 -1.1c0 0 -0.4 -0.6 -0.5 -0.4c-0.1 0.3 -0.1 0.4 -0.3 0.4c-0.1 -0.1 -0.2 1.1 -0.2 1.1l-0.3 0l0.2 -1.1c0 0 -0.3 -0.1 -0.3 -0.5c0 -0.3 0.1 -0.5 0.1 -0.7c0.1 -0.2 -0.1 -1 -0.2 -1.1c-0.1 -0.2 -0.2 -0.8 -0.2 -0.8c0 0 -0.1 -0.5 0.4 -0.8z']
)color_scale = alt.Scale(domain=domains,range=['rgb(162,160,152)', 'rgb(194,81,64)', 'rgb(93,93,93)', 'rgb(91,131,149)']
)alt.Chart(source).mark_point(filled=True, opacity=1, size=100).encode(alt.X('x:O', axis=None),alt.Y('animal:O', axis=None),alt.Row('country:N', header=alt.Header(title='')),alt.Shape('animal:N', legend=None, scale=shape_scale),alt.Color('animal:N', legend=None, scale=color_scale),
).transform_window(x='rank()',groupby=['country', 'animal']
).properties(width=550, height=140)

提供丰富的图形代码

推荐阅读:
入门: 最全的零基础学Python的问题  | 零基础学了8个月的Python  | 实战项目 |学Python就是这条捷径
干货:爬取豆瓣短评,电影《后来的我们》 | 38年NBA最佳球员分析 |   从万众期待到口碑扑街!唐探3令人失望  | 笑看新倚天屠龙记 | 灯谜答题王 |用Python做个海量小姐姐素描图 |碟中谍这么火,我用机器学习做个迷你推荐系统电影
趣味:弹球游戏  | 九宫格  | 漂亮的花 | 两百行Python《天天酷跑》游戏!
AI: 会做诗的机器人 | 给图片上色 | 预测收入 | 碟中谍这么火,我用机器学习做个迷你推荐系统电影
小工具: Pdf转Word,轻松搞定表格和水印! | 一键把html网页保存为pdf!|  再见PDF提取收费! | 用90行代码打造最强PDF转换器,word、PPT、excel、markdown、html一键转换 | 制作一款钉钉低价机票提示器! |60行代码做了一个语音壁纸切换器天天看小姐姐!|

年度爆款文案

  • 1).卧槽!Pdf转Word用Python轻松搞定!

  • 2).学Python真香!我用100行代码做了个网站,帮人PS旅行图片,赚个鸡腿吃

  • 3).首播过亿,火爆全网,我分析了《乘风破浪的姐姐》,发现了这些秘密

  • 4).80行代码!用Python做一个哆来A梦分身

  • 5).你必须掌握的20个python代码,短小精悍,用处无穷

  • 6).30个Python奇淫技巧集

  • 7).我总结的80页《菜鸟学Python精选干货.pdf》,都是干货

  • 8).再见Python!我要学Go了!2500字深度分析!

  • 9).发现一个舔狗福利!这个Python爬虫神器太爽了,自动下载妹子图片

点阅读原文,看B站我的视频!

再见Excel,这个Python数据可视化库太炫酷了相关推荐

  1. python数据可视化库_python和r中用于数据可视化的前9个库

    python数据可视化库 In the rapidly growing world of today, when technology is expanding at a rate like neve ...

  2. python每行输出5个数据_12个流行的Python数据可视化库总结

    总结了10个不同领域的 Python 数据可视化库,有常用的,也有比较小众的. 1. matplotlib matplotlib是Python数据可视化库的OG.尽管它已有十多年的历史,但仍然是Pyt ...

  3. 最近很火的数据动图python_12个流行的Python数据可视化库总结

    总结了10个不同领域的 Python 数据可视化库,有常用的,也有比较小众的. 1.  matplotlib matplotlib是Python数据可视化库的OG.尽管它已有十多年的历史,但仍然是Py ...

  4. json树状图可视化_12个流行的Python数据可视化库总结

    总结了10个不同领域的 Python 数据可视化库,有常用的,也有比较小众的. 1. matplotlib matplotlib是Python数据可视化库的OG.尽管它已有十多年的历史,但仍然是Pyt ...

  5. 视频教程-Python数据可视化库:Matplotlib视频课程-Python

    Python数据可视化库:Matplotlib视频课程 东北大学计算机专业硕士研究生,欧瑞科技创始人&CEO,曾任国内著名软件公司项目经理,畅销书作者,企业IT内训讲师,CSDN学院专家讲师, ...

  6. 全领域通吃,12个经典Python数据可视化库盘点

    责编 | 寇雪芹 头图 | 下载于视觉中国 来源 | 博文视点Broadview Python有很多数据可视化库,这些数据可视化库主要分为探索式可视化库和交互式可视化库.前者透过简单直接的视觉图形,更 ...

  7. python数据可视化库 动态的_Python数据可视化:Pandas库,只要一行代码就能实现...

    本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,如有问题请及时联系我们以作处理. 以下文章一级AI入门学习 ,作者小伍哥 刚接触Python的新手.小白,可以复制下面的链接去免费观 ...

  8. python数据可视化库 动态的_Python数据可视化:Pandas库,要是一行代码就能完成...

    本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,如有问题请及时联系我们以作处理. 以下文章一级AI入门学习 ,作者小伍哥 刚接触Python的新手.小白,可以复制下面的链接去免费观 ...

  9. [转载] Python数据可视化库-Matplotlib——折线图绘制

    参考链接: Python Matplotlib数据可视化 plot折线图 # coding:utf-8 import pandas as pd import numpy as np from matp ...

最新文章

  1. js技巧--转义符\的妙用(转)
  2. Visual Studio Xamarin中找不到iOS模拟器
  3. 一个空的C++类中有什么
  4. 全球农企对话国际农民丰收节贸易会·万祥军:拜耳谋定领先
  5. Android插件化开发基础之静态代理模式
  6. cogs2109 [NOIP2015] 运输计划
  7. 通信原理眼图画法_光纤通信链路入侵与检测技术研究综述
  8. face_recognition 安装报错问题解决
  9. 凸优化有关的数值线性代数知识 4分块消元与Schur补
  10. Java 报表工具选择
  11. 计算机实验室安全员责任书,实验室人员安全责任书
  12. 计算机丢失dll文件怎么弄,电脑缺少dll文件怎么办
  13. 树莓派智能小车资料整理
  14. 生信学习——基于R的统计习题(附详细答案解读)
  15. EasyExcel学习笔记
  16. 浏览器预检请求返回400 has been blocked by CORS policy: Response to preflight request doesn’t pass access cont
  17. 云目录(DaaS )快速入门
  18. Sublime Text 3之soda超酷主题安装及配置方法
  19. 在OpenCV里实现内旋轮线
  20. android浏览器插件开发,Android浏览器插件开发.docx

热门文章

  1. java 对接 stripe支付
  2. python中的copy()与deepcopy()
  3. 笔记本电脑查询已连接WIFI密码
  4. 上海浦东新区计算机学校排名2015,最新2015浦东新区初中排名 分为四个档次
  5. 时序分析基本概念介绍Sequential logic
  6. JavaScript知识点4
  7. 披着微电影外衣的广告 在扼杀微电影产业
  8. 2018年11月29日 16点50分 小苗苗出生了
  9. 安装使用Discuz!破解模版插件提示“您安装的不是正版应用
  10. FileNotFoundError: [Errno 2] No such file or directory:‘image.jpg’