Matplotlib: Difference between revisions
| (2 intermediate revisions by the same user not shown) | |||
| Line 11: | Line 11: | ||
import matplotlib.pyplot as plt | import matplotlib.pyplot as plt | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Set size=== | |||
<syntaxhighlight lang="python"> | |||
f, ax = plt.subplots(figsize=(5, 3)) | |||
# or | |||
plt.figure(figsize=(5, 3)) | |||
plt.tight_layout() | |||
</syntaxhighlight> | |||
===Saving a plot=== | ===Saving a plot=== | ||
<syntaxhighlight lang="python"> | <syntaxhighlight lang="python"> | ||
| Line 34: | Line 43: | ||
===Multiple Figures=== | ===Multiple Figures=== | ||
<syntaxhighlight lang="python"> | <syntaxhighlight lang="python"> | ||
f, axarr = plt.subplots(3,1) | f, axarr = plt.subplots(3,1) | ||
axarr[0].imshow(np.clip(x_val[0, 0, :, :, :].numpy(), 0, 1)) | axarr[0].imshow(np.clip(x_val[0, 0, :, :, :].numpy(), 0, 1)) | ||