| sinaset(hndl,handelsize,Xp,Yp,xlbl,xlblsize,ylbl,ylblsize,tlt,tltsize,sname)
|
function sinaset(hndl,handelsize,Xp,Yp,xlbl,xlblsize,ylbl,ylblsize,tlt,tltsize,sname)
%Syntax: sinaset(hndl,handelsize,Xp,Yp,xlbl,xlblsize,ylbl,ylblsize,tlt,tltsize,sname)
%____________________________
% By this function you could simply plot and print your figures with any
% paper size you wish and save it in any location you want
%
% xlbl string, xlabel
% ylbl string, ylabel
% tlt string, title
% xlblsize size of xlabel
% ylblsize size of ylabel
% tltsize size of title
% Xp x position in cm, e.g. Xp = 13.546666667; 512 pixel
% Yp y position in cm, e.g. Yp = 6.773333333; 256 pixel (1 pixel = 0.026458333 cm)
% hndl name of the figure handle
% hndlsize size for x and y thickers
% sname string, name of the output file to be saved. e.g. 'result\1st period\autocorr'
%
% in case of plotting a graph like autocorrelation, code it as follow:
% h1=figure
% autocorr(monthly,floor(n/2),1)
% sinaset(h1, 13.546666667, 6.773333333, 'Lag (month)', 'Correlation Coefficient', 'Autocorrelation graph for monthly WL, 1966-1995', 'result\1st period\autocorr')
%
% Sina Khatami M.
% Department of Water Resources Engineering
% Lund University
% Lund, Sweden
%
% E-mail: khatami.sina@gmail.com
% Homepage: http://lu.academia.edu/SinaKhatamiM
%____________________________
xMargin = 1; %# left/right margins from page borders
yMargin = 1; %# bottom/top margins from page borders
% set(gcf,'Position',[350,300,512,256]); %position in pixel, 300 px from the
% bottom of the screen that is 512 px in length and 256 px in height
% OR
set(hndl, 'Units','centimeters', 'Position',[350 300 Xp Yp])% position in cm
% set(hndl, 'Position',[350 300 Xp Yp])% position in cm
% creates a figure positioned 350 px from the left of the screen
xlhand=xlabel(xlbl);
ylhand=ylabel(ylbl);
set(gca,'FontSize',handelsize)
set(xlhand,'string',xlbl,'FontSize',xlblsize);
set(ylhand,'string',ylbl,'FontSize',ylblsize);
tlthndl=title(tlt, 'FontWeight','bold');
set(tlthndl,'string',tlt,'FontSize',tltsize);
set(gca,'LooseInset',get(gca,'TightInset'))
%# figure size printed on paper
set(hndl, 'PaperUnits','centimeters')
set(hndl, 'PaperSize',[Xp Yp])
set(hndl, 'PaperPosition',[xMargin yMargin Xp Yp])
set(hndl, 'PaperOrientation','portrait')
saveas(hndl,sname,'tiffn')
pause (1)
close (hndl)
|
|