[plotting] scatterplot
This commit is contained in:
BIN
plotting/lecture/images/scatterplot.png
Normal file
BIN
plotting/lecture/images/scatterplot.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
@@ -16,10 +16,6 @@
|
||||
|
||||
\input{plotting}
|
||||
|
||||
\subsection{Scatter plot}
|
||||
|
||||
\subsection{Histograms}
|
||||
|
||||
\subsection{Heatmaps}
|
||||
|
||||
\subsection{3-D plot}
|
||||
|
||||
@@ -444,7 +444,51 @@ various examples and the respective code on their website
|
||||
|
||||
For some types of plots we present examples in the following sections.
|
||||
|
||||
\subsection{Line plot, subplots}
|
||||
\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
|
||||
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
|
||||
nonsensical (figure\,\ref{scatterplotfig}\,A). In contrast to
|
||||
\codeterm{}{plot} we need to provide x- and y-coordinates in order to
|
||||
draw the data. In the example we also provide further arguments to set
|
||||
the size, color of the dots and specify that they are filled
|
||||
(listing\,\ref{scatterlisting1}).
|
||||
|
||||
\lstinputlisting[caption={Creating a scatter plot with red filled dots.},
|
||||
label=scatterlisting1, firstline=9, lastline=9]{scatterplot.m}
|
||||
|
||||
We could have used plot for this purpose and set the marker to
|
||||
something and the line-style to ``none'' to draw an equivalent
|
||||
plot. Scatter, however offers some more advanced features that allows
|
||||
to add two more dimensions to the plot
|
||||
(figure\,\ref{scatterplotfig}\,B,\,C). For each dot one can define an
|
||||
individual size and color. In this example the size argument is simply
|
||||
a vector of the same size as the data that contains number from 1 to
|
||||
the length of 'x' (line 1 in listing\,\ref{scatterlisting2}). To
|
||||
manipulate the color we need to specify a length(x)-by-3 matrix. For
|
||||
each dot we provide an individual color (i.e. the RGB triplet in each
|
||||
row of the color matrix, lines 2-4 in listing\,\ref{scatterlisting2})
|
||||
|
||||
|
||||
\lstinputlisting[caption={Creating a scatter plot with size and color
|
||||
variations. The RGB triplets define the respective color intensity
|
||||
in a range 0:1. Here, we modify only the red color channel.},
|
||||
label=scatterlisting2, linerange={15-15, 21-23}]{scatterplot.m}
|
||||
|
||||
\begin{figure}[t]
|
||||
\includegraphics{scatterplot}
|
||||
\titlecaption{Scatterplots.}{Scatterplots are used to draw
|
||||
datapoints where there is no direct dependency between the
|
||||
individual measurements (like time). Scatter offers several
|
||||
advantages over the standard plot command. One can vary the size
|
||||
and/or the color of each dot.}\label{scatterplotfig}
|
||||
\end{figure}
|
||||
|
||||
|
||||
\subsection{Subplots}
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user