Skip to content

Instantly share code, notes, and snippets.

@BlogBlocks
Last active December 8, 2017 13:46
Show Gist options
  • Select an option

  • Save BlogBlocks/bf0f63873041ab035edfb02f573d4eac to your computer and use it in GitHub Desktop.

Select an option

Save BlogBlocks/bf0f63873041ab035edfb02f573d4eac to your computer and use it in GitHub Desktop.
#!/usr/bin/python
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
# gives a base to x and y
x=[]
y=[]
with open("Crimes_file.txt") as f:
data = f.read()
data = zip(*[iter(data.split(" "))]*2)
#x, y =data[0],data[1]
for a_tuple in data: # iterates through each tuple
for item in a_tuple:
item = float(item)# iterates through each tuple items
#append x value with every read
if item >0:x.append(item)
#append y value with every read
if item<0:y.append(item)
#once all reading is comleted plot x,y
plt.scatter(x,y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment