Commit 367e25df authored by Grégoire PETIT's avatar Grégoire PETIT
Browse files

plot zombies

parent e908a3a1
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
graphetest=[[[230922.07792207794, 3074.627450980392, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
[230922.07792207794, 3074.627450980392, [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]],
[230922.07792207794, 3074.627450980392, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]]]
# random data
def isZombie(case):
res=1
if sum(case[2])==0:
res=0
return(res)
x = [[isZombie(case) for case in line] for line in graphetest]
fig, ax = plt.subplots()
# define the colors
cmap = mpl.colors.ListedColormap(['r', 'k'])
# create a normalize object the describes the limits of
# each color
bounds = [0., 0.5, 1.]
norm = mpl.colors.BoundaryNorm(bounds, cmap.N)
# plot it
ax.imshow(x, interpolation='none', cmap=cmap, norm=norm)
plt.show()
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment