Modifying an imagesc()
Plot
Here is something that might be similar enough by modifying an imagesc
plot with text annotations and the line()
function to create the grid. Some axis attributes including axis replacement needed to be done to configure the plot correctly. Unfortunately, it's not a very concise way of doing it but it might satisfy your application.
Engine_Load = [0.35 0.55 0.7 0.87 1 1.15 1.25 1.35 1.45 1.6 1.7 1.8 2 2.2 2.5];
Engine_Speed = (800:400:7600);
%Creating random test data%
[Engine_Load_Grid,Engine_Speed_Grid] = meshgrid(Engine_Load,Engine_Speed);
Estimated_Air_Fuel_Ratio = rand(length(Engine_Speed),length(Engine_Load));
%Creating the grid structure%
X_Axis = (1:length(Engine_Load));
Y_Axis = (1:length(Engine_Speed));
[X_Grid,Y_Grid] = meshgrid(X_Axis,Y_Axis);
clf;
imagesc('XData',X_Axis,'YData',Y_Axis,'CData',Estimated_Air_Fuel_Ratio);
xticks(1:1:length(X_Axis));
yticks(1:1:length(Y_Axis));
xlim([0.5 length(X_Axis)+0.5]);
ylim([0.5 length(Y_Axis)+0.5]);
Current_Axis = gca;
Current_Axis.XAxisLocation = 'Top';
grid on;
for Horizontal_Lines = 1: length(yticks)
line([0.5 length(X_Axis)+0.5],[Horizontal_Lines+0.5 Horizontal_Lines+0.5],'color','w','LineWidth',2);
end
for Vertical_Lines = 1: length(yticks)
line([Vertical_Lines+0.5 Vertical_Lines+0.5],[0.5 length(Y_Axis)+0.5],'color','w','LineWidth',2);
end
Estimated_Air_Fuel_Ratio = flip(Estimated_Air_Fuel_Ratio);
[Matrix_Height,Matrix_Width] = size(Estimated_Air_Fuel_Ratio);
for Row_Index = 1: Matrix_Height
for Column_Index = 1: Matrix_Width
text(Column_Index,Matrix_Height+1-Row_Index,num2str(Estimated_Air_Fuel_Ratio(Row_Index,Column_Index)));
end
end
Current_Figure = gcf;
set(findall(gcf,'type','text'),'HorizontalAlignment','center')
set(Current_Axis,'xtick',X_Axis,'xticklabel',Engine_Load);
set(Current_Axis,'ytick',Y_Axis,'yticklabel',Engine_Speed);
xlabel('Engine Load'); ylabel('Engine Speed');
colorbar
Current_Figure.Position = [0 0 1000 1000];
Ran using MATLAB R2019b
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…