Plotting Data as Heatmap/Bar Graph Hybrid?
Show older comments
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!
Accepted Answer
More Answers (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
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!

