Skip to content

Instantly share code, notes, and snippets.

@rsokl
Created April 16, 2021 02:08
Show Gist options
  • Save rsokl/c7e2ed1aab02b35208bb5b4c8051a931 to your computer and use it in GitHub Desktop.
Save rsokl/c7e2ed1aab02b35208bb5b4c8051a931 to your computer and use it in GitHub Desktop.
A code snippet for plotting a job from hydra-zen
def plot_jobs(*jobs, fn):
import numpy as np
import matplotlib.pyplot as plt
(jobs,) = jobs
x, y = np.arange(-2, 2, 0.1), np.arange(-2, 2, 0.1)
X, Y = np.meshgrid(x, y)
V = parabaloid(X, Y)
fig, ax = plt.subplots()
ax.contour(X, Y, V.reshape(X.shape), levels=[0.01, 0.12, 0.3, 0.5], colors="black")
for job in jobs[0]:
title, label = job.hydra_cfg.hydra.overrides.task[0].split("=")
ax.plot(
*job.return_value.T,
label=label,
)
ax.legend(title=title)
@rsokl
Copy link
Author

rsokl commented Oct 25, 2021

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment