axeshandle with matlab code
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I have 4 plots in total which I trying to plot using axeshandle, subplot but for some reason I only 3 plots the first plot is missing. Please help how to fix this
%First plot
axeshandle(1)=subplot('position',[0.13 .808 .775 .097]);
plot (A_Table1.Time,A_Table1_Var1, '*')
% Second plot which has 3 plots in itself
Days = datetime(['03/06/2023';'03/07/2023'], 'InputFormat','MM/dd/yyyy', 'Format','MM/dd/yyyy');
Data = array2table([5 50; 50 40; 55 65], 'VariableNames',string(Days), 'RowNames',{'A','B','C'})
axeshandle(2)=subplot('position',[0.13 .641 .775 .106]);
VN = Data.Properties.VariableNames;
Rows = Data.Properties.RowNames;
tiledlayout(3,1)
for k = 1:3
nexttile
plot(categorical(VN), table2array(Data(k,:)))
title(Rows{k})
ylim([0 100])
end
0 commentaires
Réponses (2)
Walter Roberson
le 7 Mar 2023
You need to stick to using subplot() or using tiledlayout() -- mixing the two can be a challenge.
You have five plots, not four, by the way. You subplot() for axeshandle1, then you subplot() for axeshandle2, then you nexttile for three plots -- a total of five axes.
Image Analyst
le 7 Mar 2023
Try it this way
% First plot on first axes
subplot(2, 1, 1); % Create second axes.
plot(rand(1,10), 'b.-', 'LineWidth', 2, 'MarkerSize', 20);
title('The first axes has 1 curve plotted')
grid on;
% First plot on second axes
subplot(2, 1, 2); % Create second axes.
plot(rand(1,10), 'b.-', 'LineWidth', 2, 'MarkerSize', 20);
% Second plot on second axes
hold on; % Don't blow away prior plots on this axes.
plot(rand(1,10), 'r.-', 'LineWidth', 2, 'MarkerSize', 20);
% Third plot on second axes
plot(rand(1,10), 'g.-', 'LineWidth', 2, 'MarkerSize', 20);
legend
hold off;
grid on;
title('The second axes has 3 curves plotted')
0 commentaires
Voir également
Catégories
En savoir plus sur Subplots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!