Hox to interplolate Griddata and set colormaps interval
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello,
I'm trying to analyze hardness mesaurement where i get three vector x,y and h
and I want to plot a map from these data (file attached) and choosing the colormaps interval.
I'am trying with this code
%% Read data
M = readmatrix('E_2022_11Cr_ODS_03.csv');
%% Get data from csv file
x1 = M(:, 1);
y1 = M(:, 2);
d1 = M(:, 3);
%% plot hardness maps
%Create regular grid across data space
n=100;
[X,Y] = meshgrid(linspace(min(x1),max(x1), n), linspace(min(y1),max(y1)), n);
g1 = griddata (x1,y1,d1, X,Y, 'cubic');
c1 = contourf(X,Y,g1 )
But i have a bad interpltation compared to map given by the hardness machine (see figures below)
Could any one helop me with these please
map with matlab
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1309290/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1309295/image.png)
thanks in advanced
댓글 수: 0
답변 (1개)
Morten Sparre Andersen
2023년 2월 27일
Your map looks fine. You see more less the features as in the plot designed by the machine.
if you use functions: image or imagesc you would get images without contours resambling the map by the machine.
You change the color map with a function: colormap, and you can get a color bar with the function colorbar.
good luck
----
When you have some free time use "help graphics" in the command window to get a list of a lot of nice graphics functions. I'm sure you wil find wonderfull fnctionalities that you can't wait trying out.
참고 항목
카테고리
Help Center 및 File Exchange에서 Colormaps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!