Difference Chart Python 2-Dimensional Matrix
I'm trying to do something that I think should be pretty straight forward, but I can't seem to get it to work.
I am trying to plot 16 byte values measured over time to see how they change. I am trying to use a scatter plot to do this with: x-axis is the measure of the dimension, y-axis is the byte index and the color is the byte value.
I have data stored in a numpy array where data [2] [14] will give me the 14th byte value in the second dimension.
Every time I try to build this I get either:
ValueError: x and y must be the same size
IndexError: index 10 is out of bounds for axis 0 with size 10
Here's an example test I'm using:
import numpy
import numpy.random as nprnd
import matplotlib.pyplot as plt
#generate random measurements
# 10 measurements of 16 byte values
x = numpy.arange(10)
y = numpy.arange(16)
test_data = nprnd.randint(low=0,high=65535, size=(10, 16))
#scatter plot the measurements with
# x - measurement index (0-9 in this case)
# y - byte value index (0-15 in this case)
# c = test_data[x,y]
plt.scatter(x,y,c=test_data[x][y])
plt.show()
I'm sure this is something stupid, I'm doing wrong, but I can't figure out what.
Thanks for the help.
+3
user2084330
source
to share