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 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
| close all
clc
%% figure simple dont on impose la taille totale du fichier pdf
% Note : le print du fichier pdf est OK mais ne correspond pas à l'écran
f = figure (1) ;
hold off
n = 100 ;
plot (rand(n,1), rand(n,1), 'o')
hold on
plot(rand(3,1), rand(3,1), '-x')
w=10; % cm
h=10; % cm
set(gcf, 'PaperPosition', [0 0 w h], ...
'PaperSize', [w, h], ...
'PaperUnits', 'centimeters')
print(f, '-dpdf', 'figure_pattern_1.pdf')
%% figure double dont on impose la taille totale du fichier pdf
f = figure (1) ;
hold off
n = 100 ;
subplot(1,2,1)
plot (rand(n,1), rand(n,1), 'o')
subplot(1,2,2)
plot(rand(3,1), rand(3,1), '-x')
w=10; % cm
h=5; % cm
set(gcf, 'PaperPosition', [0 0 w h], ...
'PaperSize', [w, h], ...
'PaperUnits', 'centimeters')
print(f, '-dpdf', 'figure_pattern_2.pdf')
%% figure avec modification des propriétés des axes
% choix de la taille de la police
f = figure (1) ;
subplot(1,1,1)
hold off
n = 100 ;
plot (rand(n,1), rand(n,1), 'o')
hold on
plot(rand(3,1), rand(3,1))
grid on
title ({'toto en km^2', 'ligne_i=2'}, ...
'Color', 'r', ...
'FontSize', 12)
w=10; % cm
h=10; % cm
set(gcf, 'PaperPosition', [0 0 w h], ...
'PaperSize', [w, h], ...
'PaperUnits', 'centimeters')
set(gca, 'FontUnits', 'points', ...
'FontSize', 10, ...
'FontWeight', 'normal', ...
'GridLineStyle', '- -', ...
'LineWidth', 1, ...
'MinorGridLineStyle', ':', ...
'XMinorGrid', 'on')
% renverse le sens des X et des Y
set(gca,'XDir','reverse', 'XAxisLocation', 'top')
set(gca,'YDir','reverse', 'YAxisLocation', 'right')
% change les limites
set(gca, 'XLim', [-0.1 1.1], 'YLim', [-0.1 1.1])
% Titres
set(get(gca,'XLabel'),'String','axis label', ...
'FontSize', 10)
set(get(gca,'YLabel'),'String','axis label', ...
'FontSize', 10)
print(f, '-dpdf', 'figure_pattern_3.pdf')
%% superimposition de figures multiples non alignées
figure(1)
hold off
axes('Position',[0.1,0.1,0.7,0.7])
contour(peaks(20))
set(gca, 'color', 'none') ; % transparent
axes('Position',[0.7,0.7,0.28,0.28])
surf(peaks(20))
%% lignes d'épaisseur différente, Latex,
% Note : le latex est OK dans le pdf, pas dans la figure.
close all
f = figure(1);
set(gcf, 'WindowStyle', 'docked')
plot(rand(3,1), rand(3,1), '-x', 'LineWidth', 2, 'Color', 'k')
hold on
plot(rand(3,1), rand(3,1), '-x', 'LineWidth', 1, 'Color', 'k')
legend ('toto', '\alpha \beta \gamma');
title('{\itAe}^{-\alpha\itt}sin\beta{\itt} \alpha<<\beta', 'FontName', 'Arial', 'FontSize', 14)
xlabel('Time \musec.', 'FontName', 'Arial', 'FontSize', 14)
ylabel('Amplitude', 'FontName', 'Arial', 'FontSize', 14)
print(f, '-dpdf', 'figure_pattern_4.pdf')
%% Texte
f = figure(1);
hold off
t=0:pi/64:2*pi;
plot(t,sin(t));
title('The Sine of 0 to 2\pi')
xlabel('t = 0 to 2\pi')
ylabel('sin(t)')
text(3*pi/4,sin(3*pi/4),...
'\leftarrow sin(t) = .707',...
'FontSize',16)
text(pi,sin(pi),'\leftarrow sin(t) = 0',...
'FontSize',16)
text(5*pi/4,sin(5*pi/4),'sin(t) = -.707\rightarrow',...
'HorizontalAlignment','right',...
'FontSize',16)
print(f, '-dpdf', 'figure_pattern_5.pdf') |
Partager