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:
# 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) axs[1, 0].scatter(data, data) axs[0, 1].plot(data, data)
Log figure into Neptune:
Log as static image
Log as interactive plotly chart
from neptunecontrib.api import log_chart log_chart(name='matplotlib_figure', chart=figure)
This option is tested with
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.
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.