- You can use pcolor to create a pseudocolor concentration map with interpolation: Pseudocolor plot - MATLAB pcolor (mathworks.com)
- Also imagesc is practical: Display image with scaled colors - MATLAB imagesc (mathworks.com)
- There is also countourf if you want to show contour lines Filled 2-D contour plot - MATLAB contourf (mathworks.com)
How do I make a heat/color map from individual data points?
조회 수: 34 (최근 30일)
이전 댓글 표시
Howdy,
I'm relatively new to Matlab and would like to create a heatmap of nitrous oxide concentration with contours over a region kind of like this with a colorbar:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/902315/image.png)
I have latitude, longitude, and nitrous oxide concentration data for specific points.
I know you can use the heatmap function and data from a matrix to make a plot like the one above but I do not know how to fill in the gaps of my individual data points across the region. Any help or methodology is appreciated and let me know if there's anymore information I can provide that might help!
댓글 수: 0
채택된 답변
AndresVar
2022년 2월 21일
You can interpolate between the points using gridded data interpolation: Interpolate 2-D or 3-D scattered data - MATLAB griddata (mathworks.com)
Then with the interpolated matrix you can display in a few ways:
댓글 수: 3
AndresVar
2022년 2월 23일
편집: AndresVar
2022년 2월 23일
your meshgrid is not right so it returns empty xq and yq
[xq, yq] = meshgrid(-89.5:.25:-88.5, 28.7:.25,30) % comma is wrong
[xq, yq] = meshgrid(-89.5:.25:-88.5, 28.7:.25:30)
Btw when you plot you can use
% figure;
% pc1 = pcolor(xq,yq,vq)
% pc1.EdgeColor = 'none';
% pc1.FaceColor = 'interp';
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!