Home > front end >  How to completly smooth the pixels in a heatmap drawn from a csv file?
How to completly smooth the pixels in a heatmap drawn from a csv file?

Time:01-14

So I was wondering if anyone can help in smoothing the pixels of a drawn heatmap using matlab or ArcGIS or anyother software( I am looking for the whole script). When I have used ArcGIS, I imported a csv file with three columns (latitude, longitude, and the wind speed values), the best result I could had is as it is shown in this screnshot. my output but the output or the heatmap I want to have must look something like this the goal.

I really tried every single solution but the pixels does not seem to dispear (even I tried QGIS software but always getting the same result). So I heard Matlab can draw also heatmap and I have never use it so if someone can help I will be thankful.

I wonder how people can draw in their research such smooth well presented heatmap? any thoughts ? I even tried to plot with python but not helping at all because Iw ant the thing drawn on a map and not in squares.

Thanks in advance.

CodePudding user response:

I have a recommendation / answer for you. One great thing about the Matlab library is that it has a built-in function called "imgaussfilt" to smooth out the pixels of whatever heatmap you are working with. You can read even more in detail about the "imgaussfilt" function with the Matlab library documentation. Another function that Matlab his in it's library is called "smoothdata". With this library function, it will also smooth out the pixels on your heat map similar to how "imgaussfilt" functions.

I don't have your example code so I can't really provide you with a script example with my modifications included, so please next time post some example code and we can help you much further with example script answers. Welcome to the community, btw.

CodePudding user response:

(In MATLAB) Read in the CSV as 'heatmap' and then smooth it using imgaussfilt.

heatmap_smooth = imgaussfilt(heatmap, 2);
imagesc(heatmap_smooth);

There are other ways to do this in base MATLAB by using the smoothdata function.

heatmap_smooth = smoothdata(heatmap,'movmean',3);

You can try the code out at https://matlab.mathworks.com/.

  • Related