how to create a circular heat map

 Réponse acceptée

Image Analyst
Image Analyst le 27 Sep 2012

0 votes

pcolor can do circular maps. But what does your angular dimension represent, and why is that representation any better than a rectangular representation (a rectangular image)?

7 commentaires

Razvan
Razvan le 27 Sep 2012
Modifié(e) : Razvan le 27 Sep 2012
Thank you! In the example images the angle represents the genomic location, along 5 chromosomes. I guess the only advantage is that they can fit in a smaller space (at least on the horizontal direction). But they look nice :)
Any idea how I can disable the black lines that mark each cell in the pcolor plot? I tried something like this in order to plot a track:
n = 500;
r = [0.8; 1];
theta = pi*(-n:0.8*n)/n;
X = r*cos(theta);
Y = r*sin(theta);
C = r*cos(2*theta);
pcolor(X,Y,C)
axis equal tight
If the tracks are too long (and they will be if they represent genomic locations), then the black lines make the plot indistinguishable. Also how can you add tick marks and labels to this?
Thanks again,
Razvan
You can set edgecolor = 'none' to get rid of the little black lines around the tiles:
[X,Y,Z] = peaks(30);
hs = pcolor(X,Y,Z+10);
set(hs, 'edgecolor', 'none')
Razvan
Razvan le 28 Sep 2012
Thank you. What about the ticks and labels around the circular plot from my example? Is there an easy way to do this?
Image Analyst
Image Analyst le 28 Sep 2012
I don't use pcolor much at all because of its problems and deceptive nature. But in general you can use set() to set various properties of anything in MATLAB. Look up what kind of thing you want to set properties of: axes, figure, etc.
Thanks. I remembered that I can get all the properties by a simple
get(someHandle)
and I can start to play with all those properties :)
One more thing: Is it possible to plot a normal function (not heat map) in a circular track, like the outer track from my first example picture? Or in other words can I bend the axes of a normal plot command along a circle in Matlab?
I can start a new Question/Thread if necessary...
Image Analyst
Image Analyst le 28 Sep 2012
If you have a 2D array of data, you can use cart2pol() to change it, but I haven't really played around with that so I'm no expert on that.
Razvan
Razvan le 28 Sep 2012
That only translates the coordinates from Cartesian to polar (or cylindrical for 3d data), but doesn't really bend the horizontal plot into a circular plot. Thanks anyway.

Connectez-vous pour commenter.

Plus de réponses (1)

Christian Günther
Christian Günther le 16 Mai 2022
Modifié(e) : Christian Günther le 16 Mai 2022

0 votes

Hello,
You can transform the Data to cartesian coordinates and use the hist3 function instead.
%polar(t,r,'+')
x = r.*cos(t);
y = r.*sin(t);
data = [x',y'];
hh3 = hist3(data, 'Nbins',[1 1]*25);
figure
image(flipud(hh3))
ax = gca;
xt = ax.XTick;
yt = ax.YTick;
ax.XTickLabel = xt*10;
set(ax, 'YTick',[0 yt], 'YTickLabel', [flip([0 yt])]*10)

Catégories

En savoir plus sur Line Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by