Interactive matplotlib figures in Google Colab

Below is an example of creating interactive iplot() in Plotly and cufflinks() on Google Colab Notebook. Used functions and suggestions from the answer [1, 2] The key seems to be to include configure_plotly_browser_state() in the cell that does the plotting. Code below should work: Import libraries import datetime from datetime import date import pandas as … Read more

How to save plotly express plot into a html or static image file?

Updated answer: With newer versions of plotly, static Image export in Python is a breeze. Just make sure to install kaleido using: pip install -U kaleido or, for Anaconda: conda install -c conda-forge python-kaleido And then run fig.write_image(“yourfile.png”) Filetypes such as .jpeg and .pdf are also available options. Producing an individual html file is still … Read more

Plotly/Dash display real time data in smooth animation

Updating traces of a Graph component without generating a new graph object can be achieved via the extendData property. Here is a small example that appends data each second, import dash import dash_html_components as html import dash_core_components as dcc import numpy as np from dash.dependencies import Input, Output # Example data (a circle). resolution = … Read more