Have problem about 2D graph
Afficher commentaires plus anciens
I'm new in Matlab program, I want to plot 2D graph and got a problem in this line
"plot(X,Y,'--d','markersize',18,'linewidth',3.5);"
Please give me any advice. Thank you
%Graph 2
filename = 'weight_before_after.xlsx' ;
readdata = xlsread(filename);
X = readdata(7:10,5);
Y = readdata(35:38,5);
plot(X,Y,'--d','markersize',18,'linewidth',3.5);
xlabel('Mass before heating (g)','fontsize',30);
ylabel('Mass after heating (g)','fontsize',30);
axis equal;
set(gca,'ytick',[0:5:10]);
set(gca,'fontsize',26);
legend('Mass before heating','Mass after heating',4);
P.S. This is data from " weight_before_after.xlsx' "


Réponses (1)
You're not using legend correctly -- get rid of the call to legend. It's not appropriate here. The rest looks fine. This works:
%Graph 2
% filename = 'weight_before_after.xlsx' ;
% readdata = xlsread(filename);
readdata = rand(38, 5); % Create sample data.
X = sort(readdata(7:10,5));
Y = readdata(35:38,5);
plot(X,Y,'--d','markersize',18,'linewidth',3.5);
xlabel('Mass before heating (g)','fontsize',30);
ylabel('Mass after heating (g)','fontsize',30);
axis equal;
set(gca,'ytick',[0:5:10]);
set(gca,'fontsize',26);
% legend('Mass before heating','Mass after heating');
Catégories
En savoir plus sur Spline Postprocessing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
