How can I download custom Plotly charts from QC research? Plotly's “fig.write_image()” seems to not work in QC. Let's say we have the following code:
import plotly.express as px
fig = px.scatter(x=[0, 1, 2, 3, 4], y=[0, 1, 4, 9, 16])
fig.write_image("test.png")
fig.show()
Pressing “Download plot as PNG” after the figure is shown allows me to save the plot image to the workspace, however, it is tedious when having lots of plots. Also, it still doesn't allow for downloading it locally, which is preferable as I intend to plot many different backtests and need to easily scroll through all images. I would hate to have to pay another stock data provider just to download and view my custom Plotly plots.
Nico Xenox
Hey @haakon-flaaronning
Did u find something?
Not the exact thing but while I was working with different dataframes in the jupyter notebook I used this simple code to show the file in a new tab/window. Maybe there is something similar for plotly/images.
I think they disabled all the options to download data from the web.
Haakon
Nico Xenox I couldn't get your code to display anything when using a test dataframe. Plotly does have a fig.write_html() function, but it exports the HTML to a file, which is seemingly not possible in QC. Really frustrating to not be able to export images…
Haakon
Nico Xenox Could you provide a full code example that displays an HTML code in a separate tab/window? When running your code, I just see the output below the cell I am running.
Nico Xenox
Hey Haakon Flaarønning
Sorry for the delay, since the new update it is apparently impossible to get anything out of QuantConnect research notebook :(
I tried it with the code I had where I import a csv and let it show in a different tab but that also got disabled.
A solution that might work but isn't really a work around might be taking a snapshot of the graph (Snipping Tool)…
Let me know if you find a better workaround in the future ;)
Haakon
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!