python绘图教程
Plotly (Plot.ly as its URL goes), is a tech-computing company based in Montreal. It is known for developing and providing online analytics, statistics and graphing tools for individuals or companies. It also develops/provides scientific graphing libraries for Arduino, Julia, MATLAB, Perl, Python, R and REST.
Plotly( 网址为Plot.ly )是一家位于蒙特利尔的技术计算公司。 它以为个人或公司开发和提供在线分析,统计和绘图工具而闻名。 它还为Arduino,Julia,MATLAB,Perl,Python,R和REST开发/提供科学图形库。
Python Plotly库 (Python Plotly Library)
Plotly’s Python graphing library makes interactive graphs online and allows us to save them offline if need be.
Plotly的Python图形库可在线生成交互式图形,并允许我们根据需要将其离线保存。
为什么情节 (Why Plotly)
Plotly has got some amazing features that make it better than other graphing libraries:
Plotly具有一些惊人的功能,使其比其他图形库更好:
- It is interactive by default 默认情况下是交互式的
- Charts are not saved as images but serialized as JSON, making them open to be read with R, MATLAB, Julia and others easily 图表不保存为图像,而是序列化为JSON,使其易于使用R,MATLAB,Julia等读取
- Exports vector for print/publication 导出矢量以进行打印/发布
- Easy to manipulate/embed on web 易于操作/嵌入网络
入门 (Getting Started)
We need PIP (python package installer) to get working with plotly, we’ll also need to create an account with plotly in case we want to use the online facilities. For this lesson, we’ll stick to offline usage only.
我们需要PIP (python软件包安装程序)才能开始使用plotly,还需要使用plotly创建一个帐户,以防我们想使用在线工具。 在本课程中,我们将仅坚持离线使用。
安装 (Installation)
To install plotly, open a terminal window and run the following command:
要以图形方式安装,请打开一个终端窗口并运行以下命令:
sudo pip install plotly
This may take a few minutes to install to collect dependencies and download them: