-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPLOT.m
More file actions
50 lines (45 loc) · 1.7 KB
/
PLOT.m
File metadata and controls
50 lines (45 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PURPOSE
% -> Plot an Image or Sinogram
% INPUT
% - f = NrXP x NrYS
% = Matrix to be plotted
% - xp = 1 x NrXP
% = x- of phi-coordinates
% - ys = 1 x NrYS
% = y- of s-coordinates
% - Type = 'Image' of 'Sinogram'
% - ColorLim = [ min, max ]
% = Limits of the colorbar, optional.
% Handy to match the color scales of several plots
% OUTPUT
% - Plot:
% * Image: 'x' horizontal to the right and 'y' vertical up
% * Sinogram: 's' horizontal to the right and 'p' vertical up
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function PLOT( f, xp,ys, Type, ColorLim )
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
switch Type
case 'Image'
% 'x' horizontal to the right and 'y' vertical up
% => transpose needed
pcolor( xp,ys, f' );
xlabel('x'); ylabel('y');
case 'Sinogram'
% f(p,s): 's' horizontal to the right and 'p' vertical up
% => NO transpose needed
pcolor( ys,xp, f );
xlabel('s'); ylabel('\theta');
otherwise
error( 'Choose as Type "Image" or "Sinogram".' )
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%% FINISHING TOUCH %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
axis square; % Depict a square image
shading flat; % Plot without grid, nor interpolation
colorbar; % Show the color bar
if ( nargin == 5 ) % Were there color limits provided? If so:
caxis( ColorLim ); % Provide the limits to scale the colors
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end