I have a rather long series of x, y coordinates representing a character in 2d space. Let's say that space is 200 x 400. I want to represent the amount of time the character is in each x, y coordinate by means of a pretty chloropleth.

I want to use heatmaply for this because I think the output is pretty and I want my audience to be able to zoom in on the data. It isn't really meant to do density estimation (I think?) so I'm trying to work around it.

I suppose the way to do this is to fill a 200x400 dataframe with counts of the number of occurrences of each x, y coordinate in the data. Essentially, to build a 2d map out of the dataframe.

So, I suppose my questions are:

1). How do I get the count of each unique x, y coordinate in my set

2). How might I pass those counts easily to the matching x, y cell in my 200x400 dataframe full of zeroes?

This seems like it should be easy but I can't seem to figure it out! I'm a novice to r and can't see the shape of what I need to do.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.