Skip to content

How to use Neptune with Plotly#

Open in Colab

Plotly is one of the most common Python graphing libraries for interactive graphs. With Neptune, you can log interactive 2D and 3D charts generated in Plotly.

Plotly figure in Neptune

See in Neptune  Example script 

Before you start#


To follow the guide without any setup, run the Colab example.

  • Sign up at
  • Create a project for storing your metadata.
  • Have Plotly and Neptune installed:

    pip install -U plotly neptune
    conda install -c conda-forge plotly neptune
Upgrading with neptune-client already installed

Important: To smoothly upgrade to the 1.0 version of the Neptune client library, first uninstall the neptune-client library and then install neptune.

pip uninstall neptune-client
pip install neptune
Matplotlib incompatibility

Plotly is not compatible with newer Matplotlib versions (3.5.0+) due to the fact that mpl_to_plotly() uses deprecated Matplotlib functionalities.

To use Plotly together with Matplotlib, you may need to downgrade your Matplotlib version to <3.5. For more information, see Plotly issue 1568 and issue 3624 on GitHub.

Plotly logging example#

  1. Import Neptune and start a run:

    import neptune
    run = neptune.init_run()  # (1)!
    1. If you haven't set up your credentials, you can log anonymously:

  2. Create a sample figure:

    import as px
    df =
    plotly_fig = px.scatter_3d(
        df, x="sepal_length", y="sepal_width", z="petal_width", color="species"
  3. Upload the interactive figure:

  4. To stop the connection to Neptune and sync all data, call the stop() method:

  5. To open the run, click the Neptune link that appears in the console output.

    Example link:


The resulting figure is logged as an HTML object.

You can view it in the All metadata section.