setting axes to a specific colour
5 views (last 30 days)
Show older comments
I am trying to make a graph where all of the axes are black
however the right y axes keeps being an uncontrolled colour
%
%
clear
close all
%
%
%%
%
%%
% extract data
TGA_1 = [29.044 29.07498 29.10418 29.13242 29.14578 29.17879 29.22682 29.23897 29.29634 29.31156;
100 99.99852 100.00471 100.00925 100.01266 100.0152 100.01706 100.01834 100.01913 100.01949];
TGA_2 = [29.043 29.0657 29.11248 29.11802 29.16212 29.17449 29.20546 29.22756 29.28798 29.31485;
100 100.00151 100.00219 100.0026 100.00287 100.00305 100.00316 100.00321 100.00319 100.00311];
% TGA_3 = OXOXCMC_03(:,[1,3]);
% TGA_4 = OXOXCMC_04(:,[1,3]);
%%
% mean of TGA analysis
% TGAsum = mean(all(:,2));
%%
% plot
figure1 = figure;
% set(axes,'YColor',[0 0 0]);
%
hold
plot(TGA_1(:,2));
plot(TGA_2(:,2));
% plot(TGA_3(:,2));
% plot(TGA_4(:,2));
% plot(TGA_1(:,1))
yyaxis('left');
ylabel('Thermogravimetric mass \%','Color',[ 0 0 0 ],'Interpreter','latex')
ax.YAxis(1).Color = [0 0 0];
yyaxis('right');
ylabel('Temperature $^{\circ}$C','Color',[ 0 0 0 ],'Interpreter','latex')
ax.YAxis(2).Color = [0 0 0];
plot(TGA_1(:,1),'--b')
How do I make sure the numbering on the right axis is black aswell?
Thanks in advance
0 Comments
Accepted Answer
Dyuman Joshi
on 8 Jan 2024
Moved: Dyuman Joshi
on 8 Jan 2024
Otherwise ax will be defined as a struct -
% extract data
TGA_1 = [29.044 29.07498 29.10418 29.13242 29.14578 29.17879 29.22682 29.23897 29.29634 29.31156;
100 99.99852 100.00471 100.00925 100.01266 100.0152 100.01706 100.01834 100.01913 100.01949];
TGA_2 = [29.043 29.0657 29.11248 29.11802 29.16212 29.17449 29.20546 29.22756 29.28798 29.31485;
100 100.00151 100.00219 100.0026 100.00287 100.00305 100.00316 100.00321 100.00319 100.00311];
% TGA_3 = OXOXCMC_03(:,[1,3]);
% TGA_4 = OXOXCMC_04(:,[1,3]);
%%
% mean of TGA analysis
% TGAsum = mean(all(:,2));
%%
% plot
figure1 = figure;
% set(axes,'YColor',[0 0 0]);
%
hold on
plot(TGA_1(:,2));
plot(TGA_2(:,2));
% plot(TGA_3(:,2));
% plot(TGA_4(:,2));
% plot(TGA_1(:,1))
yyaxis('left');
ylabel('Thermogravimetric mass \%','Color',[ 0 0 0 ],'Interpreter','latex')
%Get current axes
ax = gca;
ax.YAxis(1).Color = [0 0 0];
yyaxis('right');
ylabel('Temperature $^{\circ}$C','Color',[0 0 0],'Interpreter','latex')
ax.YAxis(2).Color = [0 0 0];
plot(TGA_1(:,1),'--b')
5 Comments
More Answers (0)
See Also
Categories
Find more on Line Plots 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!