| []=plotpub(h,xl,yl,file,w_inch,dpi,life_size)
|
function []=plotpub(h,xl,yl,file,w_inch,dpi,life_size)
%--------------------------------------------------------------------------
%Plotpub: Creates publication quality plots
%Required Inputs:
%h:plot handle. to create a plot handle, use
%h=figure command in the main script that calls
% this function
%xl: string containing the label of the x-axis
%yl: string containin the label of the y-axis
%Optional Inputs:
%file:name of the file with extension in which the
%plot will be saved
%w_inch: width of the plot in inches. The default value
% is set for 3.5 inches, which is the standard one column
%with
%dpi: dots per inch, set by default at 300dpi if nothing is specified.
%if you think the file size is too large, try reducing the dpi.If you want
% more resolution, go ahead and increase it.
%life_size: this is the magnification you want to show the real file.Set by
%default at 1.if you want to scale down the file to 50% when you put
%it in the document or presentation, you can put life size=2, so that
%fonts don't look either too small or too big.
%Tested: MATLAB 7.8.0.347(R2009a)
%Copyright:Sourav Chatterjee. sourav_c_83@yahoo.com
%--------------------------------------------------------------------------
if nargin<7
life_size=1;
end
if nargin<6
w_inch=3.5;
end
if nargin<5
dpi=300;
end
if nargin<4
file='plotpic.tiff';
end
if nargin<3
error('Too few Input Arguments');
end
ff=round(12*life_size);
%Make the figure look nice
xlabel(xl,'FontSize',ff,'FontName','Times New Roman')
ylabel(yl,'FontSize',ff,'FontName','Times New Roman')
set(gca,'FontSize',ff,'FontName','Times New Roman')
set(gca,'LineWidth',life_size*1)
%Print the figure
%This is an attempt to print a life sized figure
set(gcf, 'PaperPositionMode', 'auto')
scsize=get(0,'ScreenSize');
ppi=get(0,'ScreenPixelsPerInch');
%sizexw=7*life_size*ppi;
sizexw=w_inch*ppi;
ratio=scsize(4)/scsize(3);
sizeyh=round(ratio*sizexw);
pos1=[1,31,sizexw,sizeyh];
set(h,'position',pos1)
set(gca, 'Position', get(gca, 'OuterPosition') - ...
get(gca, 'TightInset') * [-1.25 0 1.25 0; 0 -1.25 0 1.25; 0 0 1.25 0; 0 0 0 1.25]);
%set(gcf, 'InvertHardCopy', 'off');
%End of snippet to try and produce life sized figure
pr_res=strcat('-r',num2str(dpi));
print ('-dtiffn',pr_res,file)
|
|