Embed Plotly HTML in PyCharm IDE

2019-06-23 18:01发布

问题:

I would like to see Plotly's HTML output in the PyCharm IDE. It currently says:

Process finished with exit code 0

for the output. However, I receive a graphical result in Jupyter

回答1:

To see the Plotly html output use the offline feature. For example, like this:

plotly.offline.plot(*yourplotname*, filename='file.html')

Run the code in pycharm and it will save the .html file locally in your work folder and open the .html in your browser to view.



回答2:

Dnaiel, as far as I understand plotly, it always creates an HTML file somewhere. Even in jupyter notebooks, I assume plotly creates a temporary HTML file although it draws the graph in the same window.

However, you can still use plotly in pycharm without having to specify the name of the new file. In that case, plotly simply overwrites the previous temporary HTML file in your working directory.

plotly.offline.plot(df2.iplot(kind='TypeOfChart',x='X_Var',y='Y_Var', asFigure=True))