% test file for plot showing properties of object plot
% genuine finger-typed files by Christina C. Christara

%Note: Some parts of the plot (e.g. axis titles) may not show properly
%      in the matlab window, but they show fine when saved in a ps file
%      Also some fonts may show large in the matlab window,
%      but become smaller when saved in a ps file
%      To save in a ps file
%print -depsc myplot.eps

% generate some data
n = 2.^[3:8];
e1 = 1./n.^2;
e2 = 1./n.^3;
e3 = 1./n.^4;

sz = 16; % desired size of fonts, etc. can be changed to 16, 18, 20, 22, etc

% plot, then change the properties
h = loglog(n, e1, 'r-+', n, e2, 'g-x', n, e3, 'b-*');
set(h, 'Markersize', sz-2, 'LineWidth', 2);
set(h(2), 'Markersize', sz, 'LineWidth', 3); % change only the second line width
axis([6 320 1e-10 1e-1]);
%axis tight; ax = axis; axis([ax(1)*0.8 ax(2)*1.2 ax(3)*0.8 ax(4)*1.2]);
hax = gca;
set(hax, 'FontSize', sz-2, 'TickLength', [0.02 0.05])
set(hax, 'XTick', n, 'YTick', 10.^([-10:2:-1]))
hlx = xlabel('n -- log scale'); set(hlx, 'FontSize', sz);
%px = get(hlx, 'Position'); set(hlx, 'Position', [px(1) 2*px(2) px(3)])
hly = ylabel('error -- log scale'); set(hly, 'FontSize', sz);
ht = title('convergence study'); set(ht, 'FontSize', sz);
hl = legend('second order', 'third order', 'fourth order', 0);
set(hl, 'FontSize', sz, 'TickLength', [0.02 0.05])

% another way to control plot properties
%plot(1:4, 1:4, 'ro-', 'LineWidth', 2, 'MarkerEdgeColor', 'r', ...
%     'MarkerFaceColor', 'w', 'MarkerSize', 20)
%hold on
%plot(1:4, 1:4, 'bv--', 'LineWidth', 2, 'MarkerEdgeColor', 'b', ...
%     'MarkerFaceColor', 'w', 'MarkerSize', 14);
%hold off

x = 1:10; y1 = x; y2 = x.^2;
plot(x, y1, 'ro-', 'LineWidth', 2, 'MarkerEdgeColor', 'r', ...
     'MarkerFaceColor', 'w', 'MarkerSize', 12);
hold on;
plot(x, y2, 'bv--', 'LineWidth', 2, 'MarkerEdgeColor', 'b', ...
     'MarkerFaceColor', 'w', 'MarkerSize', 12);
hold off;
hl = legend('y = x', 'y = x^2', 'Location', 'NorthWest');
set(hl, 'FontSize', 14);
