How to have diferent marker and line styles of one variable from multiple data files?

1 view (last 30 days)
How can I have diferent markers or line styles when I am plotting same variable from 8 diferent data files in one figure?
I have got my code that reads multiple excel files. its perfectly fine and plots my called variable from all 8 excel files that I am working on. Although it is alright to plot them in different color. However, somehow I can not define any marker or diferent Line Styles. I have attached my plotting codes below;
ax = gca;
grid on;
hold on
plot(Pin_dBm,Pout_Meas_dbm,"LineWidth",2)
%ax.LineStyleOrder={'-o','-+','-*','-x','-s','-d','-v','->'};
ax.ColorOrder=[1 0 0; 1 0 1; 0 1 0; 0.4660 0.6740 0.1880; 0 0 1; 0.3010 0.7450 0.9330; 0.8500 0.3250 0.0980; 0.9290 0.6940 0.1250]
ylabel('Output Power [dBm]','Color','K')
xlabel('Input Power [dBm]')
title('Output Power comparison - ON mode (0V)', 'Color', 'k')
legend('3F50Sa1','3F100Sa1', '5F50Sa1','5F100Sa1','7F50Sa1','7F100Sa1','9F50Sa1','9F100Sa1','location', 'bestoutside')
title('Output Power comparison - ON mode (0V)', 'Color', 'k')
legend('3F50Sa1','3F100Sa1', '5F50Sa1','5F100Sa1','7F50Sa1','7F100Sa1','9F50Sa1','9F100Sa1','location', 'bestoutside')

Accepted Answer

Mathieu NOE
Mathieu NOE on 2 Sep 2022
hello
see my little demo
t = 0:pi/50:2*pi;
MarkerStyle={'o','+','*','x','s','d','v','>'};
Colors=[1 0 0; 1 0 1; 0 1 0; 0.4660 0.6740 0.1880; 0 0 1; 0.3010 0.7450 0.9330; 0.8500 0.3250 0.0980; 0.9290 0.6940 0.1250]
figure(1),hold on
for ck = 1:8
p = plot(t,sin((1+0.2*ck)*t),'LineWidth',2,'Color',Colors(ck,:),'Marker',MarkerStyle{ck});
end

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!