Plottng problems in saving
1 view (last 30 days)
Show older comments
Dear all I am having a problem with saving and displaying the figugres. While I use follwoing macro, most of the title texts are away from the border of the canvas as in figure 1
But while just saving from matlab console i got as in Figure 2
So could you please suggest me how I can be fixed. Soon response will be appreciated Thank you in advance
function [f] = plotdy(data, dy, normdy, maxpk, Tlabel)
close all;
clc;
ndata = numel(data);
cumR = cumsum(data);
cumP = cumsum(dy);
gr1 = 0.25;
f = figure(1);
set(f,'OuterPosition',[50 300 1500 600]);
set(f,'PaperUnits','inches');
set(f,'PaperPosition',[0 0 17.6 5])
dyplot= subplot(1, 4, [1 3]);
plot(1:ndata,normdy,'-k', 'LineWidth',1.0);
set(dyplot,'FontSize',28)
set(gca,'Xtick',[1 ndata]);
set(gca,'Xlim',[1 ndata]);
set(gca,'TickLength',[0 0]);
y_lim = [-0.05 str2double(num2str(maxpk,2))];
y_tick = [0 str2double(num2str(maxpk,2))];
set(gca, 'Ytick', y_tick);
set(gca,'Ylim',y_lim);
t1 = title(Tlabel);
set(t1, 'FontSize',32);
cumplot = subplot(1, 4, 4);
hold on
plot(1:ndata, cumR, '-k', 'LineWidth',1.25);
plot(1:ndata, cumP,'Color',0.25*ones(1,3));
Lc = min(min(cumR), min(cumP));
Uc = max(max(cumR), max(cumP));
fitline = linspace(Lc, Uc, ndata); fitline=fitline(:);
plot(fitline, '-k');
hold off
set(cumplot,'FontSize',28)
set(gca,'Xtick',[0 ndata]);
set(gca,'Xlim',[0 ndata]);
set(gca,'TickLength',[0 0]);
set(gca,'ytick',[0 1]);
set(gca,'ylim',[-0.25 1]);
set(gca,'LineWidth',1.5);
box on
end
1 Comment
Muhammad Usman Saleem
on 2 Jun 2015
save both figure isolately... And to me your figure are different from border reason is you place hold on /off wrong in program
Answers (0)
See Also
Categories
Find more on Axis Labels in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!