Filter löschen
Filter löschen

Represent Data in Circle with Colormap

8 Ansichten (letzte 30 Tage)
Jared Hubach
Jared Hubach am 1 Feb. 2018
Beantwortet: ANKUR KUMAR am 2 Feb. 2018
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.

Antworten (1)

ANKUR KUMAR
ANKUR KUMAR am 2 Feb. 2018
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

Kategorien

Mehr zu Colormaps finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by