Python数据可视化:顶级绘图库plotly详解
作者:墨竹 | kevinelstri 时间:2021-04-09 19:37:13
有史以来最牛逼的绘图工具,没有之一
plotly是现代平台的敏捷商业智能和数据科学库,它作为一款开源的绘图库,可以应用于Python、R、MATLAB、Excel、JavaScript和jupyter等多种语言,主要使用的js进行图形绘制,实现过程中主要就是调用plotly的函数接口,底层实现完全被隐藏,便于初学者的掌握。
下面主要从Python的角度来分析plotly的绘图原理及方法:
###安装plotly:
使用pip来安装plotly库,如果机器上没有pip,需要先进行pip的安装,这里主要介绍plotly的安装。
$ pip install plotly
or
$ sudo pip install plotly
or update
$ pip install plotly --upgrade
###输出方式:
在线:
将你的可视化图像保存到网站上,便于共享和保存。
import plotly.plotly as py
import plotly.graph_objs as go
py.sign_in('DemoAccount', '2qdyfjyr7o') # 注意:这里是plotly网站的用户名和密码
trace = go.Bar(x=[2, 4, 6], y= [10, 12, 15])
data = [trace]
layout = go.Layout(title='A Simple Plot', width=800, height=640)
fig = go.Figure(data=data, layout=layout)
py.image.save_as(fig, filename='a-simple-plot.png')
from IPython.display import Image
Image('a-simple-plot.png')
离线:
直接在本地生成可视化图像,便于使用。
# -*- coding:utf-8 -*-
import plotly.plotly
import plotly.graph_objs as go
trace = go.Box(
x=[1, 2, 3, 4, 5, 6, 7]
)
data = [trace]
plotly.offline.plot(data) # 离线方式使用:offline
###plotly绘图:
基本图表:20种
统计和海运方式图:12种
科学图表:21种
财务图表:2种
地图:8种
3D图表:19种
报告生成:4种
连接数据库:7种
拟合工具:3种
流动图表:4种
JavaScript添加自定义控件:13种
来源:https://blog.csdn.net/kevinelstri/article/details/53000696
标签:Python,绘图库,plotly
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
让网站容易被发现
2009-04-20 20:35:00
Python正则表达中re模块的使用
2023-10-11 03:38:22
Python绘制牛奶冻曲线(高木曲线)案例
2022-04-05 16:35:08
![](https://img.aspxhome.com/file/2023/8/97328_0s.png)
ASP中RegExp对象正则表达式语法及相关例子
2007-08-12 17:46:00
Python Django教程之实现天气应用程序
2022-03-22 23:02:43
![](https://img.aspxhome.com/file/2023/1/69011_0s.png)
Python 12306抢火车票脚本
2023-09-12 13:36:11
浅谈python中对于json写入txt文件的编码问题
2022-01-28 05:08:58
WEB2.0网页制作标准教程(5)head区的其他设置
2007-11-13 13:28:00
python中 ? : 三元表达式的使用介绍
2022-07-30 00:29:44
使用tensorflow实现矩阵分解方式
2022-04-17 17:01:17
![](https://img.aspxhome.com/file/2023/7/89347_0s.jpg)
python修改全局变量可以不加global吗?
2021-01-11 08:10:56
![](https://img.aspxhome.com/file/2023/1/97541_0s.png)
python两个list[]相加的实现方法
2023-09-22 13:34:52
![](https://img.aspxhome.com/file/2023/6/93426_0s.png)
8个asp生成随机字符的函数
2007-08-04 10:17:00
![](https://img.aspxhome.com/file/UploadPic/20078/19/2007819193914352s.jpg)
Pytorch中膨胀卷积的用法详解
2023-03-26 12:03:25
![](https://img.aspxhome.com/file/2023/8/76078_0s.jpg)
Python函数定义及传参方式详解(4种)
2022-08-16 14:39:08
Python中一些自然语言工具的使用的入门教程
2023-08-31 06:17:01
python正则表达式常见的知识点汇总
2023-10-02 18:56:21
![](https://img.aspxhome.com/file/2023/1/99651_0s.jpg)
OpenCV-Python实现腐蚀与膨胀的实例
2023-06-05 18:07:07
![](https://img.aspxhome.com/file/2023/9/117619_0s.png)
python线程信号量semaphore使用解析
2023-02-08 08:47:24
python实现维吉尼亚算法
2023-07-02 01:28:17
![](https://img.aspxhome.com/file/2023/8/59818_0s.jpg)