Plotting Data as Heatmap/Bar Graph Hybrid?
Ältere Kommentare anzeigen
Hey so I'm plotting some temperature data from thermistors along a body to present at a research symposium, and I want to try and represent it in a way that represents what the temperature was at the specified point along the body. Using just normal pot(), the data looks like this:

what I want to do is make essentially a horizontal bar graph, where the y-axis is each of the lines in the plot above, the x-axis is time, and the color of the bar at that point in time is heatmapped to the value of that line at that time. I had tried just using heatmap() with the input data but it spit out a chart that was taken up by the division lines (there's ~22k samples for each sensor) so you couldn't actually see any of the colors.
in short, transforming the plot above > desired:
x-axis > x-axis
legend > y-axis
y-axis > bar color at x
thanks!
Akzeptierte Antwort
Weitere Antworten (1)
Here is one example code how to get such plot figure:
D = readmatrix("SENSOR_Values.txt");
Time = 0:1:height(D)-1;
% Use y-values for Color mapping
Color1 = D(:,1);
Color2 = D(:,2);
Color3 = D(:,3);
hold on
for ii = 1:width(D);
scatter(Time, D(:, ii), 20, D(:,ii), 'filled'); % 20 is the marker size
end
colormap(jet); % Choose a colormap
colorbar; % Display colorbar to show the mapping
xlabel('Time, [s]');
ylabel('Temperature, [F]');
title('Colormap Based on Temperature Values');
hold off
Kategorien
Mehr zu Data Distribution Plots finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


