2d density map in non rectangular region

I want to make this graph but instead of discrete points i want it to be a smooth color gradient. How can i do this? Every solution i found so far works with meshgrid which is not so good for this geometry. Thanks!
Code to generate the graph in the picture:
data = load('data_Temperature_T.dat');
x = data(:,1);
y = data(:,2);
T = data(:,3);
figure;
scatter(x, y, 20, T, 'filled');
axis equal tight;
colorbar;
xlabel('x'); ylabel('y');
title('Temperature');

Réponses (1)

It would help to have your data, since I cannot reproduce those curves here.
Try something like this --
n = 50;
a = linspace(pi, pi/2, n);
r = linspace(4, 20, n)*0.01;
x = [0.02*cos(a); r.*cos(a)].';
y = [0.05*sin(a); r.*sin(a)].';
figure
plot(x, y)
axis('equal')
c = [linspace(0, 0.5, n); linspace(0, 0.5, n)].';
figure
patch([x(:,1); flip(x(:,2))], [y(:,1); flip(y(:,2))], [c(:,1); flip(c(:,2))])
axis('equal')
.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange

Produits

Version

R2024b

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by