-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpurty_plot.m
More file actions
113 lines (98 loc) · 3.06 KB
/
Copy pathpurty_plot.m
File metadata and controls
113 lines (98 loc) · 3.06 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
function purty_plot(figNum, figurename)
% Use purty_plot(figureNumber, desiredFigureName)
fontName = 'Helvetica';
hFig = figNum;
% Get axes:
hAxes = get(hFig,'Children');
hPlot = [];
% Get data axes
hData = get(hAxes,'Children');
hTitle = get(hAxes,'Title');
hLegend = findobj(hFig,'Type','axes','Tag','legend');
hLabel = [get(hAxes,'xlabel') get(hAxes,'ylabel')];
% Adjust fonts of the axis
for l = 1:length(hAxes)
if iscell(hAxes)
set(hAxes{l}, ...
'FontName',fontName , ...
'FontSize', 14, ...
'Box' , 'off' , ...
'GridLineStyle' , 'none' , ...
'TickDir' , 'out' , ...
'TickLength' , [.02 .02] , ...
'XMinorTick' , 'on' , ...
'YMinorTick' , 'on' , ...
'YGrid' , 'on' , ...
'XColor' , [.3 .3 .3], ...
'YColor' , [.3 .3 .3], ...
'LineWidth' , 1 );
else
set(hAxes(l), ...
'FontName',fontName , ...
'FontSize', 14, ...
'Box' , 'off' , ...
'GridLineStyle' , 'none' , ...
'TickDir' , 'out' , ...
'TickLength' , [.02 .02] , ...
'XMinorTick' , 'on' , ...
'YMinorTick' , 'on' , ...
'YGrid' , 'on' , ...
'XColor' , [.3 .3 .3], ...
'YColor' , [.3 .3 .3], ...
'LineWidth' , 1 );
end
grid off
end
% Adjust the line smoothing
if ~isempty(hPlot)
for k = 1:length(hPlot)
if iscell(hPlot)
set(hPlot{k}, ...
'LineSmoothing', 'on',...
'LineWidth',2);
else
set(hPlot(k), ...
'LineSmoothing', 'on',...
'LineWidth',2);
end
end
end
% Adjust fonts of the labels
if ~isempty(hLabel)
for i = 1:length(hLabel)
if iscell(hLabel)
set(hLabel{i}, ...
'FontName' , fontName ,...
'FontSize' , 14 );
else
set(hLabel(i), ...
'FontName' , fontName ,...
'FontSize' , 14 );
end
end
end
% Make title purty:
for j = 1:length(hTitle)
if iscell(hTitle)
set(hTitle{j} , ...
'FontName' , fontName, ...
'FontSize' , 14 , ...
'FontWeight' , 'bold' );
else
set(hTitle(j) , ...
'FontName' , fontName, ...
'FontSize' , 14 , ...
'FontWeight' , 'bold' );
end
end
% Make legend purty:
set([hLegend] , ...
'FontSize' , 10 , ...
'FontName' , fontName , ...
'location', 'SouthWest' );
set(gcf, 'PaperPositionMode', 'auto');
%figurename_eps = [ figurename '.eps'];
%figurename_pdf = [ figurename '.pdf'];
figurename_png = [figurename '.png'];
print(figurename_png,'-dpng')
%eps2pdf(figurename_eps, figurename_pdf)