Code covered by the BSD License  

Highlights from
The Krouchev Journal-Figure Advanced MATLAB Toolkit

image thumbnail

The Krouchev Journal-Figure Advanced MATLAB Toolkit

by

 

Toward an advanced Toolkit for Journal-Figure preparation using MATLAB

demo3.m
close all; clear;

% Demo using  <The Krouchev Journal-Figure Advanced MATLAB Toolkit>
% (c) 2012

% From the XY plots in MATLAB & other Graphics demos: 

figure(1); %#1
subplot(4,1,1);
% Stem Plot
x = 0:0.1:4; y = sin(x.^2).*exp(-x); stem(x,y)

% Using axes is far more powerful than subplot:
% N.B. the axes Position is relative to the current figure #1:
ha = axes('Position', [ 1/8  1/24  3/4 	2/3 ] );
set(ha, 'Box', 'off' );
% Line Plot of a Chirp
x=0:0.05:5; y=sin(x.^2); plot(x,y);


figure(2); %#2
% Polar Plot
t=0:.01:2*pi; polar(t,abs(sin(2*t).*cos(2*t)));

figure(3); %#3
% Bar Plot of a Bell Shaped Curve
x = -2.9:0.2:2.9; bar(x,exp(-x.*x));

figure(4); %#4
% Errorbar Plot
x=-2:0.1:2; y=erf(x); e = rand(size(x))/10; errorbar(x,y,e);

%#5
% the MATLAB logo (L-membrane)
	logo

% ------------

clear; 

% layout (subfig 'montage'):

% subfig handles
% the lafig3() function called below 
% assumes the overall 'montage' is specified by the proper order of subfigures:
% i.e. later subfigures may overlap earlier
fhv = [1:5];

% #1: pos=N-W  size=2/3
% #2: pos=S-E  size=1/3
% #3: pos=S-W  size=[2/3 1/3]
% #4: pos=N-W  size=[1/3 2/3]
% #5: pos=c/r  size=1/4
FFM = [ ...
	0 	1/3  	2/3 	2/3;
	2/3 	0  	1/3 	1/3;
	0 	0  	2/3 	1/3;
	2/3 	1/3  	1/3 	2/3;
	3/8 	3/8  	1/4 	1/4;
];

newFig = 101;

hNew = lafig3(newFig, fhv, FFM);
% lafig3(newFig, fhv, FFM) = Combines KF existing (sub)figures into a new figure.
% The outputs are the axes-handles

% Any sub-figure post-processing is possible here
% e.g.
%    To Get rid of the logo's x-y axes numbering
% axes( hNew(end) ); axis off

% Set any additional whole-fig preferences you may have 
% i.e. optimize the look, so that it fits your best intention
% e.g. Renderer, Colormap, Shading etc
% set(newFig, 'Renderer', 'painters' );

newFig2 = 102;
relScl = 0.8;
zbkfig1(newFig,newFig2,relScl);
% zbkfig1=Scale down or up a whole figure to better fit the page of the (save as) .pdf

% Here you may also Set any additional whole-fig preferences you may have 
set(newFig2, 'Renderer', 'OpenGL' );


Contact us