matplotlib

Uploading figures and plots

Comet.ml allows you to upload figures and plots from matplotlib. After creating the figure just call Experiment.log_figure().

Info

Plots and figures uploaded using the Experiment.log_figure() will be available under the Graphics tab in the experiment view.

End-to-end example

import matplotlib as mpl

mpl.use('TkAgg')
# mpl.use('Agg') if you are on a headless machine

import matplotlib.pyplot as plt
import numpy as np
from comet_ml import Experiment

experiment = Experiment(project_name="matplotlib")

t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2*np.pi*t)
plt.plot(t, s)

plt.xlabel('time (s)')
plt.ylabel('voltage (mV)')
plt.title('About as simple as it gets, folks')
plt.grid(True)

experiment.log_figure(figure=plt)