How to create a graph from measurement matrix with custom colormap?
Show older comments
Hello,
First off: I´m not a Matlab expert, I´ve mostly taught it myself. I need those diagrams for my thesis and couldn´t solve it myself so far by looking in the internet.
I´ve been trying a lot to figure out the following problem:
I want to create a graph from a interpolated matrix with a custom colormap of values which have been measured; each measurement can be identified by its position (similar to a chess board, e.g. E3 or F4).

To get the data into Matlab and interpolate it I use this:
dataX=graphX('random_measurements.xlsx');
ValuesX=dataX(36:42,2:7);
ValuesX=cell2mat(ValuesX);
[xx yy] = meshgrid(1:0.1:9); %force it to interpolate at every 10th pixel
Xneu=interp2(ValuesX,xx,yy)
From that i can create 2 diagrams, one with the raw measurements, one interpolated.
figure()
surf(Xneu)
figure()
surf(ValuesX)
It´s visible that in the interpolated graph I get empty fields where the graph should already be done. How can I make it look neat?

Confusing me is that both the graphs seem to be inverted in comparison to the excel diagram below. Did I do some conversion mistake?

Related to the last issue how can I then add the annotation of the axis? I´ve already tried
set(gca,'YTickLabel',{'A';'B';'C';'D';'E';'F';'G'})
set(gca,'XTickLabel',{'7';'6';'5';'4';'3';'2'})
Is there any more elegant way imorting it from the excel?
And finally: How can I make the colorbar in those diagrams go from 0 = green to [defined value]=red. Ideally the colour change would be going in both directions (+z and -z going from 0 = green to red). I´ve already experimented with "custom colormap" and "rgb", which I didn´t manage to make it work.
Thanks in advance for any help. It will be greatly appreciated!
Answers (0)
Categories
Find more on Color and Styling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!