imshow() asserts 1:1 aspect ratio to show the image, so you can manually change the axes Position property after setting DataAspectRatioMode property to "auto"
Heatmap is too Thin in Figure
2 次查看(过去 30 天)
显示 更早的评论
How do I make this fill the figure or at least make it square?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1126420/image.png)
figure('visible', 'off');
h = histogram2(x,y,50);
figure('visible', 'on');
imshow(heatmap,[], 'XData', h.XBinEdges, 'YData', h.YBinEdges, 'InitialMagnification', 'fit');
axis on;
ax = gca;
ax.YDir = 'normal';
colormap(cmap_green);
c = colorbar;
c.Label.String = 'Average Predicted vs Actual NOx';
xlabel('Engine Speed');
ylabel('Torque');
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Colormaps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!