Skip to content

Instantly share code, notes, and snippets.

@BlogBlocks
Last active July 15, 2018 06:30
Show Gist options
  • Save BlogBlocks/58a6950f20d982ce4fbf294da9921191 to your computer and use it in GitHub Desktop.
Save BlogBlocks/58a6950f20d982ce4fbf294da9921191 to your computer and use it in GitHub Desktop.
Splits a numpy single column array into two columns (odd,even)then graphs each column separately on the same plot
import numpy as np
import matplotlib.pyplot as plt
"""
Divides a single column of a numpy array
in odd and even rows. Then graphs the odd
rows and the even rows seperatley
"""
# Numpy array - single column
sc = np.load("s-Numy-plot.npy")
# Odd numbers of the single column
x = sc[0:][::2]
# Even numbers of the single column
y = sc[1:][::2]
#smooth = raw.reshape(10,178).mean(axis=1)
N = len(sc)
x1 = np.linspace(0, 1, N/2)
x2 = np.linspace(0, 1, N/2)
#x1 = np.linspace(0, 1, ss)
#x2 = np.linspace(0, 1, 178)
plt.plot(x1, y)
plt.plot(x2, x)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment