Skip to content

Instantly share code, notes, and snippets.

@edib
Created March 20, 2017 13:23
Show Gist options
  • Select an option

  • Save edib/152e0467a029464f0edec2e2e1c62ca2 to your computer and use it in GitHub Desktop.

Select an option

Save edib/152e0467a029464f0edec2e2e1c62ca2 to your computer and use it in GitHub Desktop.
draw graph with numpy and matplotlib
from matplotlib import pyplot as plt
from matplotlib import style
import numpy as np
# print(style.available)
#['seaborn-colorblind', 'seaborn-poster', 'grayscale', 'ggplot', 'seaborn-darkgrid', 'seaborn', 'seaborn-ticks', 'seaborn-white', 'seaborn-notebook', 'seaborn-whitegrid', 'seaborn-dark-palette', 'bmh', 'dark_background', 'seaborn-dark', 'seaborn-pastel', 'seaborn-muted', 'seaborn-paper', 'seaborn-talk', 'classic', 'seaborn-deep', 'seaborn-bright', 'fivethirtyeight']
style.use('ggplot')
x,y = np.loadtxt('data.csv',unpack=True,delimiter=',')
""" data.csv
1,20
2,30
3,40
4,10
5,20
6,30
7,40
8,10
9,20
10,30
11,40
12,10
"""
plt.plot(x,y)
plt.title('Epic Chart')
plt.ylabel('Y Axis')
plt.xlabel('X Axis')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment