Skip to content

Instantly share code, notes, and snippets.

@tkshnkmr
Last active November 30, 2019 15:56
Show Gist options
  • Save tkshnkmr/294aee7b237ef2e4e0b5d6794b3e4bce to your computer and use it in GitHub Desktop.
Save tkshnkmr/294aee7b237ef2e4e0b5d6794b3e4bce to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
# Input x, output y
x = np.linspace(0, 2*np.pi, 400)
y = np.sin(x**2)
# Creates fig and ax from subplots().
# But only create a single plot
fig, ax = plt.subplots()
ax.plot(x, y)
ax.set_title('Subplot ex1: Only one plot')
# Save figure
fig.savefig('Subplot_ex1.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment