Skip to content

Instantly share code, notes, and snippets.

@fcunhaneto
Last active September 5, 2018 11:53
Show Gist options
  • Save fcunhaneto/6ec7e75a4d5ac6a8402b76adec41f330 to your computer and use it in GitHub Desktop.
Save fcunhaneto/6ec7e75a4d5ac6a8402b76adec41f330 to your computer and use it in GitHub Desktop.
Matplot selecionando posição das legendas
import numpy as np
import matplotlib.pyplot as plt
"""
Selecionando posição das legendas
"""
x = np.arange(1, 11)
print(x)
plt.figure(figsize=(6, 4))
plt.plot(x, 2*x, color='#17a589') # green
plt.plot(x, x/2, color='red')
plt.plot(x, x+3, color='#f4d03f') # yellow
plt.xlabel('x')
plt.ylabel('f(x)')
plt.grid(True)
plt.title('Retas Simples')
plt.legend(['f(x) = 2x', 'f(x) = x/2', 'f(x) = x + 3'], loc=9)
plt.savefig('reta-legendas-centro.png')
plt.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment