How to use Neptune with Matplotlib#
Matplotlib is a comprehensive library for creating static, animated, and interactive visualizations in Python. With Neptune, you can log and display Matplotlib charts as static images or interactive HTML.
See in Neptune  Code examples  
Before you start#
- Sign up at neptune.ai/register.
- Create a project for storing your metadata.
-
Have Matplotlib and Neptune installed:
(Optional) To log static Matplotlib figures as interactive Plotly charts, install the plotly library:
Tip
To follow the guide without any setup, run the example notebook in Colab
Matplotlib logging example#
-
Import Neptune and start a run:
-
If you haven't set up your credentials, you can log anonymously:
-
-
Create a sample figure:
-
Log the figure to Neptune
-
As a static image:
-
(With Plotly installed) As an interactive Plotly chart:
Info
Not all Matplotlib charts can be converted to interactive Plotly charts. If the conversion is not possible, Neptune falls back to logging the chart as an image.
-
-
To stop the connection to Neptune and sync all data, call the
stop()
method:
To open the run, click the Neptune link that appears in the console output.
[neptune] [info ] Neptune initialized. Open in the app:
https://app.neptune.ai/workspace/project/e/RUN-1
Result
The resulting figure is logged as an HTML object.
You can view it in the All metadata section.