Reputation: 2816
I am using set(gca,'LineWidth',2)
in my Figure code and getting the two images. The original image is same but second one just have an axis with a width of 2. My code is as follows
clc; clear all ;
set(gca,'LineWidth',2)
figure('DefaultAxesFontSize',30);
set(0,'DefaultAxesFontName',' Times ');
hold on
x1 =10:10:3000;
% % ---------- reading data -------%
arrival_rate = xlsread('scep.xlsx', 'comparing_thoughput_for123', 'A3:A10');
one_stream = xlsread('scep.xlsx', 'comparing_thoughput_for123', 'B3:B10');
two_stream = xlsread('scep.xlsx', 'comparing_thoughput_for123', 'C3:C10');
x2 = interp1(arrival_rate,one_stream,x1,'pchip') ;
x3 = interp1(arrival_rate,two_stream,x1,'pchip') ;
% plotting throughput
% ------scep qos1 one_stream ------
plota = plot(x1,x2,'r-','DisplayName', ' Single Stream ', 'LineWidth',1);
plot(arrival_rate,one_stream,'ro', 'HandleVisibility','off','LineWidth',2);
% ------scep qos1 two_stream ------
plot(x1,x3,'b-','DisplayName', ' Two Streams ', 'LineWidth',1);
plot(arrival_rate,two_stream,'bs', 'HandleVisibility','off','LineWidth',2);
xlabel('\lambda (events/second)')
ylabel('Thoughput (events/second)')
legend('Location','northwest')
legend show
% title('Effect of arrival rate on average CEP throughput')
% set(gcf, 'LineLineWidth', 2);
set(gcf, 'PaperUnits', 'normalized');
set(gcf, 'PaperPosition', [0 0 1 1]);
set(gcf,'PaperOrientation','l');
print -dpdf graphs/comparing_thoughput ;
What am I doing wrong?
Upvotes: 0
Views: 1550
Reputation: 60761
Create your figure first, then set the properties in it:
figure;
set(gca, 'FontSize',30, 'FontName','Times')
set(gca, 'LineWidth',2)
Note that, where there exists no figure, gcf
and gca
create one, so they can return a valid handle. So in your code, your first set(gca,...)
created a figure with an axes in it, and then you called figure
, which creates another figure.
Upvotes: 1