Graph extract example

Import:


In [1]:
%matplotlib inline

from graph_extract import Graph

Define properties of your graph:


In [2]:
path = 'graph_1.png'
x = (1500, 900)
y = (75, -100)

Make the graph object:


In [3]:
g = Graph('graph_1.png', xlim=x, ylim=y)

The image name is used as the name:


In [4]:
g.name


Out[4]:
'graph_1'

Can visualize the image:


In [5]:
g.show_img()


Out[5]:
<matplotlib.image.AxesImage at 0x117e2f588>

The fit is obtained as a series from the data property of the Graph object:


In [6]:
g.data.head()


Out[6]:
1500.000000   -4.631295
1499.598125   -4.316547
1499.196249   -4.316547
1498.794374   -4.316547
1498.392498   -4.316547
Name: graph_1, dtype: float64

This can be visualized:


In [7]:
g.show_data()


Out[7]:
<matplotlib.axes._subplots.AxesSubplot at 0x112e1f588>

This can be superimposed over the original image:


In [8]:
plt.figure(figsize=(10,8))
plt.axis('off')
g.show_fit()


We can save out the data using pandas' to_csv method:


In [9]:
g.data.to_csv('graph_1.csv')