Heat map from vector of ints and count


(Michael CC) #1

Hi,

I have a variable that consists of vector of integers and I would like to plot a heat map with the count of each element, ideally I would like these to be grouped within bins of variable sizes, due to the fact that there is no limit on the range of the values. I can simply split up the vector modifying the logstash filter but my problem doesn't change.

A simplified view of the input data could be the following:

            doc1  doc2 doc3 doc4 doc5 doc6
 vec[0]   1        1       2       2       2      1
 vec[1]   2        2       2       2       2      2
 vec[2]   2        3       3       2       2      3
 vec[3]   3        3       4       4       3      4
 vec[4]   3        2       2       3       5      5
 vec[5]   4        4       5       5       3      2

And what I would like to achieve is something like this:

    1    2    3    4    5 (value)
0   3    3    0    0    0 
1   0    6    0    0    0  
2   0    3    3    0    0 
3   0    0    3    3    0   
4   0    2    2    0    2 
5   0    1    1    2    2
(idx)

Any help would be appreaciated.
Thanks.


(Brandon Kobel) #2

Hey @Mike_CC, I'm having a hard time understanding how your inputs are correlated to your expected output, are you wanting to perform vector or matrix operations on the inputs?


(Michael CC) #3

Hi @Brandon_Kobel, in my example the vector has 6 indexes and possible values from 1 to 5. What I want to achieve is the count of each value (1 -5) for each index of the vector. If we look at the first index, i.e. vec[0], we have 3 times value 1 and 3 times value 2 so the out put vector for idx 0 is [3,3,0,0,0].

I hope I explained myself better this time.

Thank you for your time.


(Brandon Kobel) #4

Hey @Mike_CC, I can't think of a way in which you could create this chart using the built-in Heatmap visualization. Have you tried looking at Vega to do this?


(Michael CC) #5

Hi again @Brandon_Kobel, I've "discovered" Vega today, I've been looking in to it, if I get something useful I'll post it. Thank you!


(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.