用Python创建漂亮的交互式可视化效果

Plotly是一个强大的Python库,以其交互式图表、丰富的可视化类型和易用性区别于其他库。它还支持通过Dash模块将可视化部署为Web应用。本文将介绍Plotly的基础,包括标准绘图、Plotly Express和Dash,提供快速上手的代码示例。
摘要由CSDN通过智能技术生成

Plotly is an interactive Python library that provides a wide range of visualisations accessible through a simple interface.

Plotly是一个交互式Python库,通过简单的界面即可提供广泛的可视化效果。

There are many different visualisation libraries available in Python. What sets Plotly apart are the interactivity of its plots, the richness and variety of visualisations, its relative simplicity, compared to say Matplotlib and the ability to deploy visualisations as web apps using the Dash module.

Python中有许多可用的可视化库。 与Matplotlib相比,Plotly与众不同之处在于其绘图的交互性,可视化的丰富性和多样性,相对简单性以及使用Dash模块将可视化部署为Web应用程序的能力。

There are many different parts to the Plotly suite of tools and when I first started using them I found it a little difficult to navigate. In this article, I want to give a brief introduction to the core elements of Plotly including the standard plotting module, Plotly express and Dash. Alongside some simple code, examples to get you up and running quickly with these tools.

Plotly工具套件有许多不同的部分,当我第一次开始使用它们时,我发现导航有些困难。 在本文中,我想简要介绍一下Plotly的核心元素,包括标准的绘图模块,Plotly express和Dash。 除了一些简单的代码外,还提供了一些示例,使您可以使用这些工具快速入门和运行。

1.标准绘图 (1. Standard plotting)

Plotly can be pip installed.

可以piply安装。

pip install plotly

Plotly visualisations are rendered as HTML files. If you are working in a Jupyter Notebook and would like to render the images directly you need to install the ipywidgets package.

直观地将可视化呈现为HTML文件。 如果您在Jupyter Notebook中工作,并且想直接渲染图像,则需要安装ipywidgets软件包。

pip install "notebook>=5.3" "ipywidgets>=7.2"

Or if you are using JupyterLab.

或者,如果您正在使用JupyterLab。

pip install jupyterlab "ipywidgets>=7.5"
jupyter labextension install jupyterlab-plotly@4.9.0

Plotly works with data structures known as figures which can either be represented as dictionaries, in which case you use the plotly.io module. Or as graph objects rendered via the plotly.graph_objects module.

Plotly使用称为图形的数据结构工作,这些数据结构可以表示为字典,在这种情况下,请使用plotly.io模块。 或作为通过plotly.graph_objects模块渲染的图形对象。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值