필터 지우기
필터 지우기

How to represent each entry of a matrix by its own box with matlab

조회 수: 4 (최근 30일)
s.p4m
s.p4m 2016년 12월 1일
답변: s.p4m 2016년 12월 2일
Hey everybody I want to know if is possible to make a pcolor plot where the color values isn't stored on the edges of the boxes of all the little box but rather the middle of the little box. Right now I create my mesh with
x=0:50;
y=0:50;
[X,Y]=meshgrid(x,y);
and my figure with
figure
main=pcolor(X,Y,feldAIC);
colormap(cmap)
caxis([0 1]);
xlim([0 50]);
ylim([0 50]);
where cmap is my personal colormap vector and feldAIC is my matrix of the size [size(x),size(y)]. The result looks something like this:
but the shown colors must be some kind of interpolation between the four values on the corners of each little box. I would like to have something like this:
where each of my entry in my matrix feldAIC is represented by its own box and the color of the box is calculated by only the value of this entry.
So is there a way to make sure each entry is represented by its own box, rather then having each box be a interpolation of 4 entries.
  댓글 수: 4
KSSV
KSSV 2016년 12월 2일
You make all the four corner values same....
s.p4m
s.p4m 2016년 12월 2일
편집: s.p4m 2016년 12월 2일
That won't work because then I would need to assign four different values of my old matrix to the same entry of my new matrix.
For example the entry (1,1) in my new matrix would need to represent the old values for (0,0),(0,1),(1,0) and (1,1) at the same time.

댓글을 달려면 로그인하십시오.

채택된 답변

s.p4m
s.p4m 2016년 12월 2일
I found a script online which does exactly what I want
Thanks for the help

추가 답변 (1개)

KSSV
KSSV 2016년 12월 2일
Try shading interp after pcolor.
  댓글 수: 2
s.p4m
s.p4m 2016년 12월 2일
I already thought about that, but that wouldn't change the fact that the values a represented by the corners and not the box itself.
KSSV
KSSV 2016년 12월 2일
Actually I am unable to find the difference between the images attached. Both the images looks same.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by