# how to applay heatmap for trajectory line?

5 views (last 30 days)
ryunosuke tazawa on 3 May 2022
I want to know how to heatmap line on trajectory(x-y corrdinate)?
How can I deal with duplicate data?
%% フラクタル次元結果　ヒートマップで描画
clear all;
close all;
%% data for heatmap
%% trajectory data
%% XY-coordinate
X1 = sin(Theta1);
Y1 = -cos(Theta1);
X2 = X1 + sin(Theta2);
Y2 = Y1 - cos(Theta2);
Tra = [X1,Y1,X2,Y2];
x1 = zeros(10000,1);
y1 = zeros(10000,1);
x2 = zeros(10000,1);
y2 = zeros(10000,1);
F = zeros(10000,1);
for i=1:10000
x1(i) = X1(i);
y1(i) = Y1(i);
x2(i) = X2(i);
y2(i) = Y2(i);
end
%% draw trajectory
figure(1)
plot(x1,y1,'bo','MarkerFaceColor','b','MarkerSize',5)
hold on
plot(x2,y2,'bo','MarkerFaceColor','b','MarkerSize',5)
grid on
%% I want to draw heatmap curve on trajectory
figure(2)
%[x1i,y1i] = meshgrid(x1,y1);
%[x2i,y2i] = meshgrid(x2,y2);
%f = scatteredInterpolant(x1,y1,F);
%h = scatteredInterpolant(x2,y2,F);
%Fi=f(x1i,y1i);
%Fi =h(x2i,y2i);
%J = figure(2);
%scatter(x1,y1,70,F,'filled')
%hold on
%scatter(x2,y2,70,F,'filled')
%J = gca;
%J.FontSize = 20;
%J.FontName = 'Times New Roman';
%ylabel('Y','fontSize',18);
%xlabel('Y','fontSize',18);
%colormap(jet(256))
%colorbar

### Categories

Find more on Data Distribution Plots in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by