# Help needed in creating heatmap

**URL:** <https://discourse.processing.org/t/help-needed-in-creating-heatmap/500>\
**Category:** Coding Questions\
**Created:** [May 29, 2018, 4:56pm UTC](https://discourse.processing.org/t/help-needed-in-creating-heatmap/500 "2018-05-29T16:56:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ranaaman29](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@ranaaman29](https://discourse.processing.org/u/ranaaman29)\
**Post date:** [May 29, 2018, 4:56pm UTC](https://discourse.processing.org/t/help-needed-in-creating-heatmap/500/1 "2018-05-29T16:56:41Z")

</div>

Hi there  
I am new to Processing. I am trying to create a heat map using arduino and processing via serial communication. Arduino sending data in csv format  
Xaxis, Yaxis, Sensor.  
Xaxis, Yaxis, Sensor.  
Xaxis, Yaxis, Sensor.  
This is what I am doing at serialEvent

void serialEvent(Serial port)  
{  
data = port.readStringUntil(’.’);  
data = data.substring(0, data.length() - 1);  
index = data.indexOf(",");  
xAxis = data.substring(0, index);  
index2 = data.indexOf(",");  
yAxis = data.substring (index+1 , index2);  
sensor = data.substring (index+2 , data.length());  
Something wrong there as I am not able to split string into variables properly.  
I want to plot that in 2d heat image. I want to fill each pixel or rectangular blob with corresponding xy, with sensor data and it create heat map. I tried to plot but didn’t succeed. I want to hold pixels values in image until sensor update them. Any help with code will be appreciated. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [May 30, 2018, 5:27am UTC](https://discourse.processing.org/t/help-needed-in-creating-heatmap/500/2 "2018-05-30T05:27:57Z")

</div>

You need to format your code. Edit your post. Highlight your code and press the icon `</>`.

Check these posts:

> [How to create a heatmap from list of X Y Points - Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/26371/how-to-create-a-heatmap-from-list-of-x-y-points)  
> [Heat Map Color Resolution - Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/20004/heat-map-color-resolution)

I also recommend you post an mcve.

Kf
