fixed many index entries
This commit is contained in:
@@ -112,16 +112,15 @@ the missing information ourselves. Thus, we need a second variable
|
||||
that contains the respective \varcode{x} values. The length of
|
||||
\varcode{x} and \varcode{y} must be the same otherwise the later call
|
||||
of the \varcode{plot} function will raise an error. The respective
|
||||
call will expand to \code[plot()]{plot(x, y)}. The x-axis will be now
|
||||
be scaled from the minimum in \varcode{x} to the maximum of
|
||||
\varcode{x} and by default it will be plotted as a line plot with a
|
||||
solid blue line of the linewidth 1pt. A second plot that is added to the
|
||||
figure will be plotted in red using the same settings. The
|
||||
order of the used colors depends on the \enterm{colormap} settings
|
||||
which can be adjusted to personal taste or
|
||||
need. Table\,\ref{plotlinestyles} shows some predefined values that
|
||||
can be chosen for the line style, the marker, or the color. For
|
||||
additional options consult the help.
|
||||
call will expand to \code[plot()]{plot(x, y)}. The x-axis will now be
|
||||
scaled from the minimum in \varcode{x} to the maximum of \varcode{x}
|
||||
and by default it will be plotted as a line plot with a solid blue
|
||||
line of the linewidth 1pt. A second plot that is added to the figure
|
||||
will be plotted in red using the same settings. The order of the used
|
||||
colors depends on the \enterm{colormap} settings which can be adjusted
|
||||
to personal taste or need. Table\,\ref{plotlinestyles} shows some
|
||||
predefined values that can be chosen for the line style, the marker,
|
||||
or the color. For additional options consult the help.
|
||||
|
||||
\begin{table}[htp]
|
||||
\titlecaption{Predefined line styles (left), colors (center) and
|
||||
@@ -184,8 +183,8 @@ chosen.
|
||||
\subsection{Changing the axes properties}
|
||||
|
||||
The first thing a plot needs are axis labels with correct units. By
|
||||
calling the functions \code[xlabel]{xlabel('Time [ms]')} and
|
||||
\code[ylabel]{ylabel('Voltage [mV]')} these can be set. By default the
|
||||
calling the functions \code[xlabel()]{xlabel('Time [ms]')} and
|
||||
\code[ylabel()]{ylabel('Voltage [mV]')} these can be set. By default the
|
||||
axes will be scaled to show the full extent of the data. The extremes
|
||||
will be selected as the closest integer for small values or the next
|
||||
full multiple of tens, hundreds, thousands, etc.\ depending on the
|
||||
@@ -196,8 +195,8 @@ functions expect a single argument, that is a 2-element vector
|
||||
containing the minimum and maximum value. Table\,\ref{plotaxisprops}
|
||||
lists some of the commonly adjusted properties of an axis. To set
|
||||
these properties, we need to have the axes object which can either be
|
||||
stored in a variable when calling \varcode{plot} (\code{axes =
|
||||
plot(x,y);}) or can be retrieved using the \code[gca]{gca} function
|
||||
stored in a variable when calling \varcode{plot} (\varcode{axes =
|
||||
plot(x,y);}) or can be retrieved using the \code{gca()} function
|
||||
(gca stands for ``get current axes''). Changing the properties of the axes
|
||||
object will update the plot (listing\,\ref{niceplotlisting}).
|
||||
|
||||
@@ -253,8 +252,8 @@ and the placement of the axes on the
|
||||
paper. Table\,\ref{plotfigureprops} lists commonly used
|
||||
properties. For a complete reference check the help. To change the
|
||||
figure's appearance, we need to change the properties of the figure
|
||||
object which can be retrieved during creation of the figure (\code{fig
|
||||
= figure();}) or by using the \code{gcf} (``get current figure'')
|
||||
object which can be retrieved during creation of the figure (\code[figure()]{fig
|
||||
= figure();}) or by using the \code{gcf()} (``get current figure'')
|
||||
command.
|
||||
|
||||
The script shown in the listing\,\ref{niceplotlisting} exemplifies
|
||||
@@ -334,10 +333,10 @@ the last one defines the output format (box\,\ref{graphicsformatbox}).
|
||||
properties could be read and set using the functions
|
||||
\code[get()]{get} and \code[set()]{set}. The first argument these
|
||||
functions expect are valid figure or axis \emph{handles} which were
|
||||
returned by the \code{figure} and \code{plot} functions, or could be
|
||||
retrieved using \code[gcf()]{gcf} or \code[gca()]{gca} for the
|
||||
returned by the \code{figure()} and \code{plot()} functions, or could be
|
||||
retrieved using \code{gcf()} or \code{gca()} for the
|
||||
current figure or axis handle, respectively. Subsequent arguments
|
||||
passed to \code{set} are pairs of a property's name and the desired
|
||||
passed to \code{set()} are pairs of a property's name and the desired
|
||||
value.
|
||||
\begin{lstlisting}[caption={Using set to change figure and axis properties.}]
|
||||
frequency = 5; % frequency of the sine wave in Hz
|
||||
@@ -351,8 +350,8 @@ the last one defines the output format (box\,\ref{graphicsformatbox}).
|
||||
set(figure_handle, 'PaperSize', [5.5, 5.5], 'PaperUnit', 'centimeters', ...
|
||||
'PaperPosition', [0, 0, 5.5, 5.5]);
|
||||
\end{lstlisting}
|
||||
With newer versions the handles returned by \varcode{gcf} and
|
||||
\varcode{gca} are ``objects'' and setting properties became much
|
||||
With newer versions the handles returned by \code{gcf()} and
|
||||
\code{gca()} are ``objects'' and setting properties became much
|
||||
easier as it is used throughout this chapter. For downward
|
||||
compatibility with older versions set and get still work in current
|
||||
versions of \matlab{}.
|
||||
@@ -371,7 +370,7 @@ For some types of plots we present examples in the following sections.
|
||||
\subsection{Scatter}
|
||||
|
||||
For displaying events or pairs of x-y coordinates the standard line
|
||||
plot is not optimal. Rather, we use \code[scatter()]{scatter} for this
|
||||
plot is not optimal. Rather, we use \code{scatter()} for this
|
||||
purpose. For example, we have a number of measurements of a system's
|
||||
response to a certain stimulus intensity. There is no dependency
|
||||
between the data points, drawing them with a line-plot would be
|
||||
@@ -417,8 +416,8 @@ A very common scenario is to combine several plots in the same
|
||||
figure. To do this we create so-called subplots
|
||||
figures\,\ref{regularsubplotsfig},\,\ref{irregularsubplotsfig}. The
|
||||
\code[subplot()]{subplot()} command allows to place multiple axes onto
|
||||
a single sheet of paper. Generally, \varcode{subplot} expects three argument
|
||||
defining the number of rows, column, and the currently active
|
||||
a single sheet of paper. Generally, \code{subplot()} expects three
|
||||
argument defining the number of rows, column, and the currently active
|
||||
plot. The currently active plot number starts with 1 and goes up to
|
||||
$rows \cdot columns$ (numbers in the subplots in
|
||||
figures\,\ref{regularsubplotsfig}, \ref{irregularsubplotsfig}).
|
||||
@@ -439,7 +438,7 @@ figures\,\ref{regularsubplotsfig}, \ref{irregularsubplotsfig}).
|
||||
By default, all subplots have the same size, if something else is
|
||||
desired, e.g.\ one subplot should span a whole row, while two others
|
||||
are smaller and should be placed side by side in the same row, the
|
||||
third argument of \varcode{subplot} can be a vector or numbers that
|
||||
third argument of \code{subplot()} can be a vector or numbers that
|
||||
should be joined. These have, of course, to be adjacent numbers
|
||||
(\figref{irregularsubplotsfig},
|
||||
listing\,\ref{irregularsubplotslisting}).
|
||||
@@ -457,7 +456,7 @@ columns, need to be used in a plot. If you want to create something
|
||||
more elaborate, or have more spacing between the subplots one can
|
||||
create a grid with larger numbers of columns and rows, and specify the
|
||||
used cells of the grid by passing a vector as the third argument to
|
||||
\varcode{subplot}.
|
||||
\code{subplot()}.
|
||||
|
||||
\lstinputlisting[caption={Script for creating subplots of different
|
||||
sizes \figref{irregularsubplotsfig}.},
|
||||
@@ -498,12 +497,12 @@ more apt. Accordingly, four arguments are needed (line 12 in listing
|
||||
\ref{errorbarlisting}). The first two arguments are the same, the next
|
||||
to represent the positive and negative deflections.
|
||||
|
||||
By default the \code{errorbar} function does not draw a marker. In the
|
||||
By default the \code{errorbar()} function does not draw a marker. In the
|
||||
examples shown here we provide extra arguments to define that a circle
|
||||
is used for that purpose. The line connecting the average values can
|
||||
be removed by passing additional arguments. The properties of the
|
||||
errorbars themselves (linestyle, linewidth, capsize, etc.) can be
|
||||
changed by taking the return argument of \code{errorbar} and changing
|
||||
changed by taking the return argument of \code{errorbar()} and changing
|
||||
its properties. See the \matlab{} help for more information.
|
||||
|
||||
\begin{figure}[ht]
|
||||
@@ -530,18 +529,18 @@ areas instead of errorbars: In case you have a lot of data points with
|
||||
respective errorbars such that they would merge in the figure it is
|
||||
cleaner and probably easier to read and handle if one uses an error
|
||||
area instead. To achieve an illustration as shown in
|
||||
figure\,\ref{errorbarplot} C, we use the \code{fill} command in
|
||||
figure\,\ref{errorbarplot} C, we use the \code{fill()} command in
|
||||
combination with a standard line plot. The original purpose of
|
||||
\code{fill} is to draw a filled polygon. We hence have to provide it
|
||||
\code{fill()} is to draw a filled polygon. We hence have to provide it
|
||||
with the vertex points of the polygon. For each x-value we now have
|
||||
two y-values (average minus error and average plus error). Further, we
|
||||
want the vertices to be connected in a defined order. One can achieve
|
||||
this by going back and forth on the x-axis; we append a reversed
|
||||
version of the x-values to the original x-values using \code{cat} and
|
||||
\code{fliplr} for concatenation and inversion, respectively (line 3 in
|
||||
version of the x-values to the original x-values using \code{cat()} and
|
||||
\code{fliplr()} for concatenation and inversion, respectively (line 3 in
|
||||
listing \ref{errorbarlisting2}; Depending on the layout of your data
|
||||
you may need concatenate along a different dimension of the data and
|
||||
use \code{flipud} instead). The y-coordinates of the polygon vertices
|
||||
use \code{flipud()} instead). The y-coordinates of the polygon vertices
|
||||
are concatenated in a similar way (line 4). In the example shown here
|
||||
we accept the polygon object that is returned by fill (variable p) and
|
||||
use it to change a few properties of the polygon. The \emph{FaceAlpha}
|
||||
@@ -561,9 +560,9 @@ connecting the average values (line 12).
|
||||
The \code[text()]{text()} or \code[annotation()]{annotation()} are
|
||||
used for highlighting certain parts of a plot or simply adding an
|
||||
annotation that does not fit or does not belong into the legend.
|
||||
While \varcode{text} simply prints out the given text string at the
|
||||
While \code{text()} simply prints out the given text string at the
|
||||
defined position (for example line in
|
||||
listing\,\ref{regularsubplotlisting}) the \varcode{annotation}
|
||||
listing\,\ref{regularsubplotlisting}) the \code{annotation()}
|
||||
function allows to add some more advanced highlights like arrows,
|
||||
lines, ellipses, or rectangles. Figure\,\ref{annotationsplot} shows
|
||||
some examples, the respective code can be found in
|
||||
@@ -583,9 +582,9 @@ listing\,\ref{annotationsplotlisting}. For more options consult the
|
||||
|
||||
\begin{important}[Positions in data or figure coordinates.]
|
||||
A very confusing pitfall are the different coordinate systems used
|
||||
by \varcode{text} and \varcode{annotation}. While \varcode{text}
|
||||
by \varcode{text()} and \varcode{annotation()}. While \varcode{text()}
|
||||
expects the positions to be in data coordinates, i.e.\,in the limits
|
||||
of the x- and y-axis, \varcode{annotation} requires the positions to
|
||||
of the x- and y-axis, \varcode{annotation()} requires the positions to
|
||||
be given in normalized figure coordinates. Normalized means that the
|
||||
width and height of the figure are expressed by numbers in the range
|
||||
0 to 1. The bottom/left corner then has the coordinates $(0,0)$ and
|
||||
@@ -624,9 +623,9 @@ Lissajous figure. The basic steps are:
|
||||
is created and opened for writing. This also implies that is has to
|
||||
be closed after the whole process (line 31).
|
||||
\item For each frame of the video, we plot the appropriate data (we
|
||||
use \code[scatter]{scatter} for this purpose, line 20) and ``grab''
|
||||
use \code{scatter()} for this purpose, line 20) and ``grab''
|
||||
the frame (line 28). Grabbing is similar to making a screenshot of
|
||||
the figure. The \code{drawnow}{drawnow} command (line 27) is used to
|
||||
the figure. The \code{drawnow()} command (line 27) is used to
|
||||
stop the excution of the for loop until the drawing process is
|
||||
finished.
|
||||
\item Write the frame to file (line 29).
|
||||
|
||||
Reference in New Issue
Block a user