Basic Structure Again, the iplot() function is used for Jupyter notebook, and will display the plots within the notebook. The Plotly offline mode also enables you to save graphs locally. plot (data, filename = 'file.html') 它创建一个名为 file.html 的文件,并在Web浏览器中将其打开。 但是,如果您这样做:
使用plotly.offline.plot(data,filename='file.html')函数可以在本地新建一个HTML文件,并可以选择是否在浏览器中打开这个文件。 使用py.offline.init_notebook_mode()进行初始化,利用plotly.offline.iplot函数可在Jypyter notebook直接绘图。 import plotly import plotly.graph_objs as go import numpy as np # So we can use random numbers in examples # Must enable in order to use plotly off-line (vs. in the cloud... hate cloud) plotly.
(Jan-19-2018, 07:18 PM) j.crater Wrote: Your line #import plotly.offline as offline is commented (line starts with # symbol means it is a comment). offline.
The source for this library is on GitHub: plotly/dash-html-components. Dash is a web application framework that provides pure Python abstraction around HTML, CSS, and JavaScript. 4.1 在线绘图的配置. To plot offline, you can use plotly.offline.plot() or plotly.offline.iplot(). Instead of writing HTML or using an HTML templating engine, you compose your layout using Python structures with the dash-html-components library. plotly. 1、plotly基础知识 1.1、offline.plot和offline.iplot. offline.plot(data, filename = 'basic-line', auto_open= True) となります。以下のプログラムをコピペして実行してみてください。
init_notebook_mode () plotly的在线绘图个人设置. You can vote up the examples you like or vote down the ones you don't like. 有两种配置方式, 方式一:代码配置。即在绘图代码里面进行配置。在使用plotly绘图之前,添加如下代码即可: import plotly plotly.tools.set_credentials_file(username='DemoAccount', api_key='lr1c37zw81') Dash HTML Components. plot() creates an HTML page that is saved locally to be opened in a web browser. The following are code examples for showing how to use plotly.offline.plot().They are from open source Python projects. PyCharm also colours comments differently than rest of code, so you can spot it easily. # import plotly.plotly as py <- オンライン用 import plotly.offline as offline # <- オフライン用 import plotly.graph_objs as go プロットする場合は. offline.
Next time when posting code, please put code in Python code tags.