Code does not show the effect in .mlx but when run in command window it will show the effect and how to make the labels in bold
Show older comments
Hello master's
I'm not sure about this if some command won't run in .mlx becuase if i run my code with this code
clc, clearvars, close all
data1=readtable("FTIR.xlsx", 'PreserveVariableNames',true);
x1=data1.("F1(DCM_eluted)");
FF1_DCM_eluted=data1.("y1");
FF2_THF_eluted=data1.("y2");
FF3_EA_eluted=data1.("y3");
FF4_MeOH_eluted=data1.("y4");
FF5_H2O_eluted=data1.("y5");
Fwhole_sugar=data1.("y6");
figure()
h=stackedplot(x1,[FF1_DCM_eluted,FF2_THF_eluted,FF3_EA_eluted, ...
FF4_MeOH_eluted,FF5_H2O_eluted,Fwhole_sugar]);
%labels
h.XLabel = {'Wavenumber (cm^-1)'};
h.DisplayLabels = {'','','','','',''};
h.AxesProperties(1).LegendLabels = {'F1-DCM-eluted'};
h.AxesProperties(1).LegendVisible = 'on';
h.AxesProperties(1).LegendLocation = 'northwest';
h.AxesProperties(2).LegendLabels = {'F2-THF-eluted'};
h.AxesProperties(2).LegendVisible = 'on';
h.AxesProperties(2).LegendLocation = 'northwest';
h.AxesProperties(3).LegendLabels = {'F3-EA-eluted'};
h.AxesProperties(3).LegendVisible = 'on';
h.AxesProperties(3).LegendLocation = 'northwest';
h.AxesProperties(4).LegendLabels = {'F4-MeOH-eluted'};
h.AxesProperties(4).LegendVisible = 'on';
h.AxesProperties(4).LegendLocation = 'northwest';
h.AxesProperties(5).LegendLabels = {'F5-H2O-eluted'};
h.AxesProperties(5).LegendVisible = 'on';
h.AxesProperties(5).LegendLocation = 'northwest';
h.AxesProperties(6).LegendLabels = {'Whole Sugar'};
h.AxesProperties(6).LegendVisible = 'on';
h.AxesProperties(6).LegendLocation = 'northwest';
%colors
h.LineProperties(1).Color = 'r';
h.LineProperties(2).Color = 'g';
h.LineProperties(3).Color = 'b';
h.LineProperties(4).Color = 'm';
h.LineProperties(5).Color = 'c';
h.LineProperties(6).Color = 'k';
%linewidth
h.LineProperties(1).LineWidth = 2;
h.LineProperties(2).LineWidth = 2;
h.LineProperties(3).LineWidth = 2;
h.LineProperties(4).LineWidth = 2;
h.LineProperties(5).LineWidth = 2;
h.LineProperties(6).LineWidth = 2;
%this two last line of code will not show any effect in .mlx file but running in command window it will show effect
ax = findobj(h.NodeChildren, 'Type','Axes');
set(ax, 'XTick', 500:500:4000, 'XLim', [500,4000],'XDir','reverse');
of Adam Danz it will not show any effect

but if i run it in the command window it will show this

2 Comments
Walter Roberson
on 24 Aug 2022
I am not sure why you say that it will not show any effect? The top plot does show a reversed x axes which is what you want.
Stark Volt
on 24 Aug 2022
Accepted Answer
More Answers (0)
Categories
Find more on Scripts in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!