필터 지우기
필터 지우기

Represent Data in Circle with Colormap

조회 수: 8 (최근 30일)
Jared Hubach
Jared Hubach 2018년 2월 1일
답변: ANKUR KUMAR 2018년 2월 2일
I have a set of data in a 1x48 array. This data represents temperature values of radial slices of a circle (Basically the temperatures of 48 slices of pie around the same pie). I need to find a way to translate those temperature values from the array into a circular plot that would represent a temperature profile of sorts. So far, I have found the following color wheel code that is close to what I desire, with the large exception of not being able to input data:
N = 48;
c = colormap(jet(48));
th = linspace(0, 2*pi, N);
r = 0.5:0.5:1;
[TH,R] = meshgrid(th,r);
[X,Y] = pol2cart(TH,R);
C = bsxfun(@times,(X + Y),th);
figure(1)
surf(X,Y,C)
view([0 90])
axis square
grid off
This code produces the base shape for what I need to achieve, but I need the colormap to represent data that I can input, instead of just arbitrary values. It would be ideal to assign the selected data to each of the "pie slices" created by the linspace function, but I can't seem to figure it out. Thank you in advance.

답변 (1개)

ANKUR KUMAR
ANKUR KUMAR 2018년 2월 2일
You can define your own colormap or you can use predefined colormaps too
colormap jet(15) %if you want 15 colors on the colorbar
colormap cool(20) %20 colors on the colorbar
Define your own colormap:
CC=[238,233,233;216,192,216;255,193,193;238,106,167;205,0,205;...
138,43,226;131,111,255;30,144,255;...
0,238,118;69,139,0;...
238,118,0;255,0,0]
colormap(CC/255)
colorbar

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by