Neptune-Matplotlib IntegrationΒΆ
This integration lets you log charts generated in matplotlib, like confusion matrix or distribution, in Neptune.

Follow these steps:
Create an experiment:
import neptune neptune.init(api_token='ANONYMOUS',project_qualified_name='shared/showroom') neptune.create_experiment()
Create a matplotlib figure:
For example:
# matplotlib figure example 2 from matplotlib import pyplot import numpy numpy.random.seed(19680801) data = numpy.random.randn(2, 100) figure, axs = pyplot.subplots(2, 2, figsize=(5, 5)) axs[0, 0].hist(data[0]) axs[1, 0].scatter(data[0], data[1]) axs[0, 1].plot(data[0], data[1])
Log figure into Neptune:
Log as static image
experiment.log_image('diagrams', figure)
Log as interactive plotly chart
from neptunecontrib.api import log_chart log_chart(name='matplotlib_figure', chart=figure)
Note
This option is tested with matplotlib==3.2.0
and plotly==4.12.0
. Make sure that you have correct versions installed.
In the absence of plotly, log_chart
silently falls back on logging the chart as a static image.
Explore the results in the Neptune dashboard:
Static image is logged into the logs section:

Interactive figure is logged as artifact into the charts folder. Check out this experiment in the app.

Note
Not all matplotlib charts can be converted to interactive plotly charts. If conversion is not possible, neptune-client will emit a warning and fall back on logging the chart as an image.