2.2.2.1. How do I change the line width?
To change the line width, do the following:
set(h,'LineWidth',size) where h is the handle to a line and size is the width you want. The default line width is 0.5.
2.2.2.2. How do I change the line style order on printouts?
The following is an M-file that allows you to cycle through the line styles in the order you want when you print:
function prtlines(a1,a2,a3,a4,a5) % PRTLINES is a front-end to PRINT which converts
% solid lines to various line styles for graphical
% output. The change is transparent to the user.
% Non-solid lines are not affected.
%
% PRTLINES is used in the same manner as PRINT.
%
% The default line styles are:
%
% '. '
% 'o '
% 'x '
% '+ '
% '- '
% '* '
% ': '
% '-.'
% '--'
%
% The line style can be changed by editing the file
% and changing the 'styles' array.
%
% SEE ALSO: PRINT, Properties of LINE
% Written by John L. Galenski III
% All Rights Reserved 10/14/93
% LDM101493jlg
%% PRTLINES is an M-file developed by me for my own
%% personal use, and therefore, it is not supported
%% by The MathWorks, Inc., or myself. Please direct
%% any questions or comments to johng@mathworks.com.
% Create the array of line styles.
styles = [
'. '
'o '
'x '
'+ '
'- '
'* '
': '
'-.'
'--'
];
% Get the Children of the Figure.
a = get(gcf,'children');
% Check the Children of 'a'. If they are
% solid lines, then change their LineStyle
% property.
for j = 1:length(a)
l = sort(get(a(j),'children'));
X = 0;
Add = 0;
for i = 1:length(l)
if strcmp( 'line', get(l(i), 'type' ))
if strcmp(get(l(i),'linestyle'),'-')
X = X + 1;
LINE = [LINE;l(i)];
SI = rem(X,length(styles));
if SI == 0
Add = 1;
end
set(l(i),'linestyle', styles(SI+Add,:));
end
end
end
end
% Construct the PRTCMD.
PRTCMD = 'print';
for x = 1:nargin
PRTCMD = [PRTCMD,' ',eval(['a',int2str(x)])];
end
% Discard the changes so that the Figure is not
% updated.
drawnow discard
eval(PRTCMD)
% RESET THE LINESTYLES
set(LINE,'linestyle','-')
% Discard the changes so that the Figure is not
% updated.
drawnow discard
2.2.2.3. How do I cycle through the line color order?
You can set the default color order for the axes by doing the following:
set(gca,'ColorOrder',A) where A is an RGB vector of any length.
2.2.3. Positions
2.2.3.1. How do I change the size and position of my figure window?
There is a property of the figure window called Position where the x-position, y-position, width, and height are stored. To change this, do the following:
pos=[x_position, y_position, width, height]; set(gcf,'Position',pos)
2.2.3.2. How do I define an invisible axis?
There is a property of the axis called Visible . You can set Visible to off as follows:
set(gca,'Visible','off') This is very useful if you want to place text in the figure window with respect to the borders of the figure, rather than with respect to the axes.
2.2.3.3. Which units should I use?
There are five different types of units you can use: inches, centimeters, normalized, points, and pixels. To make sure what you get out of your printer looks like what you have on your screen, we recommend using normalized units.
0 Comments:
Post a Comment