[plotting] finished translation

This commit is contained in:
Jan Grewe 2017-10-26 17:57:16 +02:00
parent 5087bdf386
commit ec457e2b60

View File

@ -25,13 +25,13 @@ of ink spent on the data and that spent on other parts of the plot
should be strongly in favor of the data. Ornamental of otherwise should be strongly in favor of the data. Ornamental of otherwise
unnecessary gimicks should not be used in scientific contexts. An unnecessary gimicks should not be used in scientific contexts. An
exception can be made if the particular figure was designed for exception can be made if the particular figure was designed for
didactiv purposes and sometimes for presentations. didactic purposes and sometimes for presentations.
\begin{important}[Correct labeling of plots] \begin{important}[Correct labeling of plots]
A data plot must be sufficiently labeled: A data plot must be sufficiently labeled:
\begin{itemize} \begin{itemize}
\item Every axis must have a label and the correct unit, if it has one.\\ \item Every axis must have a label and the correct unit, if it has
(e.g. \code[xlabel()]{xlabel('Speed [m/s]'}). one.\\ (e.g. \code[xlabel()]{xlabel('Speed [m/s]'}).
\item When more than one line is plotted, they have to be labeled \item When more than one line is plotted, they have to be labeled
using the figure legend, or similar \matlabfun{legend()}. using the figure legend, or similar \matlabfun{legend()}.
\item If using subplots that show similar information on the axes, \item If using subplots that show similar information on the axes,
@ -48,9 +48,9 @@ didactiv purposes and sometimes for presentations.
\section{Things that should be avoided.} \section{Things that should be avoided.}
When plotting scientific data we should take great care to avoid When plotting scientific data we should take great care to avoid
suggestive or misleading presentations. Unnecessary additions and fancy suggestive or misleading presentations. Unnecessary additions and
graphical effects make a plot frivolous and also violate the \emph{ink fancy graphical effects make a plot frivolous and also violate the
minimization principle}. Illustrations in comic style \emph{ink minimization principle}. Illustrations in comic style
(\figref{comicexamplefig}) are not suited for scientific data in most (\figref{comicexamplefig}) are not suited for scientific data in most
instances. For presentations or didactic purposes, however, using a instances. For presentations or didactic purposes, however, using a
comic style may be helpful to indicate that the figure is a mere comic style may be helpful to indicate that the figure is a mere
@ -143,7 +143,10 @@ plots. By calling \code[plot()]{plot(x, y)} a simple line plot will be
created. This figure, however is missing any annotations like axis created. This figure, however is missing any annotations like axis
labeling, a legend, etc.. There are two options to edit the plot: (i) labeling, a legend, etc.. There are two options to edit the plot: (i)
the graphical user interface (GUI) or the command line. Both ways have the graphical user interface (GUI) or the command line. Both ways have
there use and their pros and cons. their right to exist associated with respective pros and cons. The UI
way of editing plots is ideal for experimenting the command line
approach is best suited for automation and to achieve a consistent
layout across figures and graphs.
\begin{figure} \begin{figure}
\begin{minipage}[t]{0.6\textwidth} \begin{minipage}[t]{0.6\textwidth}
@ -161,11 +164,11 @@ there use and their pros and cons.
will open the \emph{Property Editor}.}\label{ploteditorfig} will open the \emph{Property Editor}.}\label{ploteditorfig}
\end{figure} \end{figure}
While it is very convenient to edit a figure using the GUI \vspace{1ex} While it is very convenient to edit a figure using the
(\figref{ploteditor}), it is hard to re-create the exact same plot GUI (\figref{ploteditorfig}), it is hard to re-create the exact same
later on or transfer the changes done to one figure to another. plot later on or transfer the changes done to one figure to
another. \matlab{} figures consist of several graphical objects:
Figures consist of several graphical objects:
\begin{enumerate} \begin{enumerate}
\item \enterm[figure]{Figure}: This object represents the whole \item \enterm[figure]{Figure}: This object represents the whole
drawing area, it holds properties like background color, the size of drawing area, it holds properties like background color, the size of
@ -175,7 +178,7 @@ Figures consist of several graphical objects:
line widths, etc.. line widths, etc..
\item \enterm[lines]{Lines}: The drawn data lines. Holds properties \item \enterm[lines]{Lines}: The drawn data lines. Holds properties
like line width and color, the name associated with the line, marker like line width and color, the name associated with the line, marker
size ... size and many more.
\item \enterm[annotations]{Annotations}: Annotations like textboxes \item \enterm[annotations]{Annotations}: Annotations like textboxes
and or arrows that can be used to highlight points or segments. and or arrows that can be used to highlight points or segments.
\item \enterm[legends]{Legends}: Legends of the data plot. One can \item \enterm[legends]{Legends}: Legends of the data plot. One can
@ -195,205 +198,210 @@ settings to several figures, re-create the figure automatically when
the data was changed or the same kind of plot has to be created for a the data was changed or the same kind of plot has to be created for a
number of datasets. number of datasets.
\begin{important}[Manuelle Bearbeitung vermeiden] \begin{important}[Why manual editing should be avoided.]
Das nachtr\"agliche Bearbeiten und Beschriften der Abbildungen mit On first glance the manual editing of a figure using common tools
einem beliebigen Graphikprogramm erscheint auf den ersten Blick like Corel draw, Illustrator, etc.\,appears some much more
bequem, birgt aber seine eigenen Risiken (z.B. verrutschte Achsen, convenient and less complex. This, however, is not entirely
verlorengegangene Beschriftungen, etc.) und ist auf lange Sicht sehr true. What if the figure has to be re-drawn or updated? Then the
aufwendig, da bei ver\"anderter Datenlage die Graphik nur manuell editing work starts all over again. Rather, there is a great risk
reproduzierbar ist. Deshalb sollten publikationsreife Abbildungen immer associated with this approach. Axes are shifted, fonts have not been
vollst\"andig aus \matlab{} heraus erzeugt werden und eine embedded into the final document, annotations have been copy pasted
Nachbearbeitung mit Graphikprogrammen m\"oglichst ganz vermieden between figures and are not valid. All of these mistakes can be
werden. found in publications and then require an erratum, which is not
desirable. Even if it appears more cumbersome in the beginning one
should always try to create publication-ready figures directly from
the data analysis tool using scripts or functions to properly
layout the plot.
\end{important} \end{important}
\subsection{Einfaches Plotten} \subsection{Simple plotting}
Einen einfachen Linienplot zu erstellen ist denkbar Creating a simple line-plot is rather easy. Assuming there exists a
einfach. Angenommen, es existiert einer Variable \varcode{y} im varaible \varcode{y} in the \codeterm{Workspace} that contains the
\enterm{Workspace}, die die darzustellenden Daten enth\"alt. Es measurement data it is enough to call \code[plot()]{plot(y)}. At the
gen\"ugt folgender Funktionsaufruf: \code[plot()]{plot(y)}. Wenn bislang noch first call of this function a new window will be opened and the data
keine Abbildung erstellt wurde, \"offnet \matlab{} ein neues Fenster will be plotted with as a line plot. If you repeatedly call this
und stellt die Daten als Linienplot dar. Dabei werden die Datenpunkte function the current plot will be replaced unless the the
durch eine Linie verbunden. Die Messpunkte selbst sind nicht \code[hold]{hold on} command was issued before. If it was, the current
sichtbar. Wenn schon eine Abbildung existiert, wird der Inhalt plot is held and a second line will be added to it. Calling
ersetzt. Das Festhalten von bestehenden Plots kann an- oder abgestellt \code[hold]{hold off} will release the plot and any subsequent
werden indem \code{hold on} bzw. \code{hold off} vor dem \code{plot()} plotting will replace the previous plot.
Befehl aufgerufen wird.
In our previous call to \varcode{plot} we have provided just a single
Im obigen Plot Aufruf wird nur ein Argument, das \varcode{y}, an die variable containing the y-values of the plot. The x-axis will be
Funktion \code{plot()} \"ubergeben. \code{plot()} erh\"alt nur die scaled from zero to the number of elements in \varcode{y} the x-values
y-Werte. \matlab{} substituiert in diesem Fall die fehlenden x-Werte, are automatically substituted assuming a constant stepsize of 1. This
indem eine Schrittweite von 1 angenommen wird. Die x-Achse reicht also automatic scaling is probably not desired and thus, we need to provide
von 1 bis zur L\"ange des Vektors \varcode{y}. Diese Skalierung der the missing information ourselves. The respective call will expand to
x-Achse ist nur in den wenigsten F\"allen erw\"unscht. Besser ist es, \code[plot()]{plot(x, y)}. In axis will be scaled from the minimum in
die zugeh\"origen x-Werte explixit zu \"ubergeben und so z.B. die \varcode{x} to the maximum of \varcode{x} and by default it will be
y-Werte als Funktion der Zeit darzustellen (\code[plot()]{plot(x, y)}). plotted as a line plot with a solid blue line of the with 1pt. A
Standard\"a{\ss}ig wird der erste Lininenplot in blau, mit second plot that is added to the figure will be plotted in red using
durchgezogener Linie, ohne Marker und der Strichst\"arke 1 the same standard settings. The order of the used colors depends on
dargestellt. Der zweite Linienplot erh\"alt automatisch die Farbe the \enterm{colormap} settings which can be adjusted to personal taste
'rot'. Alle anderen Eigenschaften sind identisch. Die Reihenfolge der or need. Table\,\ref{plotlinestyles} shows some predefined values
Farben ist vordefiniert kann aber durch das Setzen einer that can be chosen for the line style, the marker, or the color. For
\enterm{colormap} beeinflusst werden. Die Tabellen additional options consult the help.
\ref{plotlinestyles} zeigen vordefinierte Werte f\"ur den Linienstil,
die Farbe und die verschiedenen Marker.
\begin{table}[tp] \begin{table}[tp]
\titlecaption{Vordefinierte Linienstile (links), Farben (Mitte) und Markersymbole (rechts).}{}\label{plotlinestyles} \titlecaption{Predefined line styles (left), colors (center) and
marker symbols (right).}{}\label{plotlinestyles}
\begin{tabular}[t]{lc} \hline \begin{tabular}[t]{lc} \hline
\textbf{Linienstil} & \textbf{K\"urzel} \erh \\\hline \textbf{line styles} & \textbf{abbreviation} \erh \\\hline solid
durchgezogen & '\verb|-|' \erb \\ & '\verb|-|' \erb \\ dashed & '\verb|--|' \\ dotted &
gestrichelt & '\verb|--|' \\ '\verb|:|' \\ dash-dotted & '\verb|.-|' \\\hline
gepunktet & '\verb|:|' \\
Strichpunkte & '\verb|.-|' \\\hline
\end{tabular} \end{tabular}
\hfill \hfill
\begin{tabular}[t]{lc} \hline \begin{tabular}[t]{lc} \hline
\textbf{Farbe} & \textbf{K\"urzel} \erh \\ \hline \textbf{color} & \textbf{abbreviation} \erh \\ \hline red & 'r' \erb
Rot & 'r' \erb \\ \\ green & 'g' \\ blue & 'b' \\ cyan & 'c' \\ magenta & 'm'
Gr\"un & 'g' \\ \\ yellow & 'y' \\ black & 'k' \\ \hline
Blau & 'b' \\
Cyan & 'c' \\
Magenta & 'm' \\
Gelb & 'y' \\
Schwarz & 'k' \\ \hline
\end{tabular} \end{tabular}
\hfill \hfill
\begin{tabular}[t]{lc} \hline \begin{tabular}[t]{lc} \hline
\textbf{Markersymbol} & \textbf{K\"urzel} \erh \\ \hline \textbf{marker symbols} & \textbf{abbreviation} \erh \\ \hline circle &
Kreis & 'o' \erb \\ 'o' \erb \\ star & '*' \\ plus & '+' \\ cross & 'x' \\ diamond &
Stern & '*' \\ 'd' \\ pentagram & 'p' \\ hexagram & 'h' \\ square & 's'
Plus & '+' \\ \\ triangle & '\^{}' \\ inverted triangle & 'v' \\ triangle left
Kreuz & 'x' \\ & '$<$'\\ triangle right & '$>$'\\\hline
Diamant & 'd' \\
Pentagramm & 'p' \\
Hexagramm & 'h' \\
Quadrat & 's' \\
Dreieck & '\^{}' \\
Umgekehrtes Dreieck & 'v' \\
Dreieck links & '$<$'\\
Dreieck rechts & '$>$'\\\hline
\end{tabular} \end{tabular}
\end{table} \end{table}
\subsection{Ver\"andern von Linieneigenschaften} \subsection{Changing properties of a line plot}
Die Eigenschaften des Linienplots k\"onnen \"uber weitere Argumente Die properties of line plots can be changed by passing more arguments
der \code{plot()} Funktion ver\"andert werden. Folgender Aufruf (Listing to the \varcode{plot} function. The command show in
\ref{settinglineprops})erzeugt einen roten Linienplot mit gepunkteter listing\,\ref{settinglineprops} creates line plot using the dotted
Linie der St\"arke 1.5 und Sternmarkern an den Positionen der line style, setting the line width to 1.5pt, a red line color is
Datenpunkte. Zus\"atzlich wird noch die Eigenschaft chosen, and star marker symbols will be used. Finally the name of the
\code{displayname} gesetzt, um dem Linienplot einen Namen zu curve is set to 'plot 1' which will be displayed in a legend, if
geben, der in einer Legende verwendet werden kann. chosen.
\begin{lstlisting}[label=settinglineprops, caption={Setzen von Linieneigenschaften beim \varcode{plot} Aufruf}] \begin{lstlisting}[label=settinglineprops, caption={Setting line properties when calling \varcode{plot}.}]
x = 0:0.1:2*pi; x = 0:0.1:2*pi; y = sin(x); plot( x, y, 'color', 'r', 'linestyle',
y = sin(x); ':', 'marker', '*', 'linewidth', 1.5, 'displayname', 'plot 1')
plot( x, y, 'color', 'r', 'linestyle', ':', 'marker', '*', 'linewidth', 1.5, 'displayname', 'plot 1')
\end{lstlisting} \end{lstlisting}
\subsection{Ver\"andern von Achseneigenschaften} \begin{important}[Choosing the right color.]
Choosing the perfect color goes a little bit beyond personal
Das erste, was ein Plot zus\"atzlich braucht, ist eine taste. When creating a colored plot you may want to consider the
Achsenbeschriftung. Mithilfe der Funktionen \code[xlabel()]{xlabel('Time [ms]')} following:
und \code[ylabel()]{ylabel('Voltage [V]')} k\"onnen diese gesetzt \begin{itemize}
werden. \item A substantial amount (about 9\%) of the male population can
not distinguish between red and green.
Standardm\"a{\ss}ig setzt Matlab die Grenzen der x- und y-Achse so, \item Can you distinguish the colors in a b/w respectively gray
dass die Daten hineinpassen. Dabei wird meist auf den n\"achsten scale print?
ganzzahligen Wert aufgerundet. Mit den Funktionen \code{xlim()} und \item Color figures in publications often cost extra money.
\code{ylim()} k\"onnen die Grenezen der Achsen aber auch manuell \end{itemize}
eingestellt werden. Die Funktionen \code{xlim()} und \code{ylim()} \end{important}
erwarten als Argument einen 2-elementigen Vektor mit dem Minimum und
dem Maximum der jeweiligen Achse. Tabelle \ref{plotaxisprops} listet \subsection{Changing the axis properties}
weitere h\"aufig genutzte Einstellungen der Achsen. Mit der
\code{set()} - Funktion k\"onnen diese ver\"andert werden wie in Zeile The first thing a data plot needs are axis labels with a correct
15 in Listing \ref{niceplotlisting} gezeigt. Die \code{set()} - unit. By calling the functions \code[xlabel]{xlabel('Time [ms]')} and
Funktion erwartet als erstes Argument ein sogenanntes Handle der \code[ylabel]{ylabel{'Voltage [mV]'}} these can be set. By default the
Achse, dieses wird gefolgt von einer beliebig langen Reihe von axes will be scaled to show the whole data range. The extremes will be
Eigenschaft-Wert Paaren. Soll z.B. das Gitternetz der x-Achse gezeigt selected as the closest integer for small values of the next full
werden, wird die Eigenschaft \code{XGrid} auf den Wert multiple of tens, hundreds, thousands, etc. depending on the maximum
\varcode{'on'} gesetzt: \code[set()!set(gca, 'XGrid', value. If these defaults do not match our needs the limits of the axes
'on')]{set(gca, 'XGrid', 'on');}. Das erste Argument ist ein Aufruf can be explicitly set with the functions \code[xlim()]{xlim()} and
der Funktion \code{gca}, \enterm{get-current-axis} und ist das Achsenhandle \code[ylim()]{ylim()} functions. To do this, the functions expect a
der gerade aktiven Achse. single argument that is a vector containing the minimum and maximum
value. Table\,\ref{plotaxisprops} list some of the commonly adjusted
properties of an axis. These properties can be set using the
\code[set()]{set()} function. The \code{set} function expects as a
first argument a \enterm{handle} of the affected axis. An axis handle
of the current plot is returned by the \code[gca]{gca} function (gca
stands for ``get current axis''). The following arguments passed to
\code{set} are pairs of the property name and the desired value. It is
possible to set any number of properties using a single call to
\code{set}. See listing\,\ref{niceplotlisting} (lines 20 and 21) for an
example.
\begin{table}[tp] \begin{table}[tp]
\titlecaption{Ausgew\"ahlte Eigenschaften der Achse.}{ Alle Eigenschaften der Achse findet man in der Hilfe oder im \codeterm{Property Editor} (\figref{ploteditorfig}). Wenn es eine definierte Auswahl von Einstellungen gibt, z.B. bei der Eigenschaft \code{Box}, dann ist die Standardeinstellungen als erstes gelistet.}\label{plotaxisprops} \titlecaption{Incomplete list of axis properties.}{For a complete
list consult the help system or open the property editor when an
axis is selected (\figref{ploteditorfig}). If there is a default
value of a property it will be listed first.}\label{plotaxisprops}
\begin{tabular*}{1\textwidth}{lp{5.8cm}p{5.5cm}} \hline \begin{tabular*}{1\textwidth}{lp{5.8cm}p{5.5cm}} \hline
\textbf{Eigenschaft} & \textbf{Beschreibung} & \textbf{Optionen} \erh \\ \hline \textbf{property} & \textbf{Description} & \textbf{options} \erh
\code{Box} & Definiert, ob der Rahmen der Achse vollst\"andig gezeichnet wird. & $\{'on'|'off'\}$ \erb \\ \\ \hline \code{Box} & Defines whether the axes are drawn an all
\code{Color} & Hintergrundfarbe des Koordinatensystems. & Beliebige RGB, CMYK Werte. \\ sides. & $\{'on'|'off'\}$ \erb\\
\code{Fontname} & Der Name der Schriftart. & Im System installierte Schriften. \\ \code{Color} & Background color of the drawing area, not the whole figure. & Any RGB or CMYK
\code{FontSize} & Gr\"o{\ss}e der Schrift. & Skalarer Wert.\\ values. \\
\code{FontUnit} & Einheit, in der die Schriftgr\"o{\ss}e bestimmt wird. & $\{'points' | 'centimeters' | 'inches', ...\}$\\ \code{FontName} & Name of the font used for labeling. & Installed fonts. \\
\code{FontWeight} & Fett- oder Normalsatz der Schrift. & $\{'normal' | 'bold'\}$\\ \code{FontSize} & Fontsize used for labels. & any scalar value.\\
% & 'd' \\ ?????? \code{FontUnit} & Unit in which the font size is given. & $\{'points' | 'centimeters' | 'inches',
\code{TickDir} & Richtung der Teilstriche auf der Achse. & $\{'in' | 'out'\}$\\ ...\}$\\ \code{FontWeight} & Bold or normal font. & $\{'normal' | 'bold'\}$\\
\code{TickLength} & L\"ange der Haupt- und Nebenteilstriche & \\ \code{TickDir} & Direction of the axis ticks. & $\{'in' | 'out'\}$\\
\code{X-, Y-, ZDir} & Richtung der Achsskalierung. & $\{'normal' | 'reversed'\}$\\ \code{TickLength} & Length of the ticks. & scalar value\\
\code{X-, Y-, ZGrid} & Sollen Gitternetzlinien gezeigt werden? & $\{'off'|'on'\}$ \\ \code{X-, Y-, ZDir} & Direction of axis scaling. Zero bottom/left, or not? & $\{'normal' | 'reversed'\}$\\
\code{X-, Y-, ZScale} & Lineare oder logarithmische Skalierung der Achse. & $\{'linear' | 'log'\}$\\ \code{X-, Y-, ZGrid} & Defines whether grid line for the respective axes should be plotted? &
\code{X-, Y-, ZTick} & Position der Teilstriche auf der Achse. & Vektor mit Positionen.\\ $\{'off'|'on'\}$ \\
\code{X-, Y-, ZTickLabel} & Beschriftung der Teilstriche. & Vektor mit entsprechenden Zahlen oder Cell-Array mit Strings.\\ \hline \code{X-, Y-, ZScale} & Linear of logarithmic scaling? & $\{'linear' | 'log'\}$\\
\code{X-, Y-, ZTick} & Position of the tick marks. & Vector of positions.\\
\code{X-, Y-, ZTickLabel} & Labels that should be use to label the ticks. & Vector of numbers or a cell-array of strings.\\ \hline
\end{tabular*} \end{tabular*}
\end{table} \end{table}
\subsection{Ver\"andern von Figure-Einstellungen} \subsection{Changing the figure properties}
\begin{table}[tp] \begin{table}[tp]
\titlecaption{Ausgew\"ahlte Eigenschaften der Figure.}{Alle Eigenschaften der \enterm[figure]{Figure} findet man in der Hilfe von \matlab{} oder im \codeterm{Property Editor} wenn die Abbildung ausgew\"ahlt wurde (\figref{ploteditorfig}).}\label{plotfigureprops} \titlecaption{Incomple list of available figure properties.}{For a complete reference consult the \matlab{} help or select the property editor while having the figuree background selected
(\figref{ploteditorfig}).}\label{plotfigureprops}
\begin{tabular*}{1\textwidth}{lp{6.6cm}p{5.7cm}} \hline \begin{tabular*}{1\textwidth}{lp{6.6cm}p{5.7cm}} \hline
\textbf{Eigenschaft} & \textbf{Beschreibung} & \textbf{Optionen} \erh \\ \hline \textbf{property} & \textbf{description} & \textbf{options}
\code{Color} & Hintergrundfarbe der Zeichenfl\"ache. & Beliebige RGB, CMYK Werte. \erb \\ \erh \\
\code{PaperPosition} & Position der Abbildung auf dem Papier & 4-elementiger Vektor mit den Positionen der linken-unteren, und rechten-oberen Ecke. \\ \hline \code{Color} & Background color of the figure, not the drawing area. & Any RGB, CMYK values. \erb
\code{PaperSize} & Gr\"o{\ss}e der des Papiers. & 2-elementiger Vektor mit der Papiergr\"o{\ss}e.\\ \\ \code{PaperPosition} & Position of the axes on the paper. & 4-element vector containing the positions of the botom-left and top-right corners. \\
\code{PaperUnits} & Einheit, in der die Papiergr\"o{\ss}e bestimmt wird. & $\{'inches' | 'centimeters' | 'normalized' | 'points'\}$\\ \code{PaperSize} & Size of the paper. & 2-element vector defining width and height.\\
\code{Visible} & Hilfreich, wenn ein Plot aus Performanzgr\"unden nicht auf dem Bildschirm gezeigt, sondern direkt gespeichert werden soll. & $\{'on' | 'off'\}$\\ \hline \code{PaperUnits} & Unit in which size and postition are given. & $\{'inches' | 'centimeters' |
'normalized' | 'points'\}$\\
\code{Visible} & Defines whether the plot should actually be drawn on screen. Useful when plots should not be displayed but directly saved to file. & $\{'on' | 'off'\}$\\ \hline
\end{tabular*} \end{tabular*}
\end{table} \end{table}
Wie die Achse, hat auch das \codeterm{Figure} Element eine Reihe von Like axes also the whole figure has several properties that can be
Eigenschaften, die nach Bedarf mit der \code{set()} - Funktion gesetzt adjusted to the current needs. Most notably the paper (figure) size
werden k\"onnen (Tabelle \ref{plotfigureprops} listet die and the placement of the axes on the
meistverwendeten). Das erste Argument f\"ur \code{set()} ist jetzt paper. Table\,\ref{plotfigureprops} lists commonly used ones. For a
aber eine Handle f\"ur die Abbildung, nicht das complete reference check the help. To change the properties, we again
Koordinatensystem. Statt der Funktion \code{gca} wird \code{gcf} use the \code{set()} function. The first argument is now a handle to
(\enterm{get-current-figure}) benutzt. the current figure, not the current axis as before. Analogously to the
\code{gca} command there is a \code{gcf} (``get current figure'')
Das folgende Listing \ref{niceplotlisting} zeigt wie ein Skript command with which the handle can be retrieved.
aussehen k\"onnte, das die notwendigen Anpassungen vornimmt. Bei jedem
Aufruf des Skripts wird exakt der gleiche Plot (Abbildung The script shown in the listing\,\ref{niceplotlisting} exemplifies
\ref{spikedetectionfig}) erstellt und gespeichert. Erw\"ahnenswert several features of the plotting system and automatically generates
sind hier vor allem die Zeilen 2 und 3 in denen die Gr\"o{\ss}e der and saves figure\,\ref{spiekdetectionfig}. With any execution of this
Abbildung in Zentimetern definiert wird. In Zeile 16 wird die script exactly the same plot will be created. If we decided to plot a
Abbildung dann in genau der angegebenen Gr\"o{\ss}e im ``pdf'' Format different recording, the format will stay exactly the same, just the
gespeichert. Dazu wird die Funktion \code{saveas()} verwendet, die als data changes. Of special interest are the lines 22 and 23 which set
erstes Argument wieder ein Handle auf die Figure erwartet. Das zweite the size of the figure and line 26 which saves the figure in the 'pdf'
Argument ist der Dateiname, und zuletzt muss das gew\"unschte Format format to file. When calling the function \code{saveas()} the first
(Box \ref{graphicsformatbox}) angegeben werden. argument is the current figure handle a, the second the file name, and
the last one defines the output format (box\,\ref{graphicsformatbox}).
\begin{figure}[t] \begin{figure}[t]
\includegraphics{spike_detection} \includegraphics{spike_detection} \titlecaption{Automatically
\titlecaption{Automatisch erstellter Plot.}{Dieser Plot wurde vollst\"andig created plot.}{This plot has been created using the code in
mit dem Skript in Listing \ref{niceplotlisting} erstellt und listing\,\ref{niceplotlisting}.}\label{spikedetectionfig}
gespeichert.}\label{spikedetectionfig}
\end{figure} \end{figure}
\begin{ibox}[t]{\label{graphicsformatbox}Dateiformate f\"ur Abbildungen.}
Es gibt zwei grunds\"atzlich verschiedene Arten von Dateiformaten f\"ur \begin{ibox}[t]{\label{graphicsformatbox}File formats for digital artwork.}
Graphiken: There are two fundamentally different types of formats for digital artwork:
\begin{enumerate} \begin{enumerate}
\item \determ{Rastergraphik} (\enterm{bitmap}) \item \enterm{Bitmaps}
\item \determ{Vektorgraphik} (\enterm{vector graphics}) \item \enterm{Vector graphics}
\end{enumerate} \end{enumerate}
Bei Rastergraphiken wird f\"ur jeden Bildpunkt (jedes Pixel) der When using bitmaps a color is given for each pixel of the stored
aktuelle Farbwert angegeben. Rastergraphiken haben eine bestimmte figure. Bitmaps do have a fixed resolution (e.g.\,300\,dpi --- dots
Aufl\"osung (z.B. 300\,dpi --- dots per inch). Sie sind vor allem per inch), they are very useful for photographs. In the contrary
f\"ur Fotos geeignet. Im Gegensatz dazu werden bei Vektorgraphiken vector graphics store descriptions of the graphic in terms of so
die Abbildungen durch sogenannte Primitive (Linien, Kreise, called primitives (lines, circles, polygons, etc.). The main
Polygone, ...) beschrieben. Der Vorteil der Vektorgraphiken advantage of a vector graphic is that it can be scaled without a
ist die Skalierbakeit ohne Qualit\"atsverlust. loss of quality.
\begin{minipage}[t]{0.38\textwidth} \begin{minipage}[t]{0.38\textwidth}
\mbox{}\\[-2ex] \mbox{}\\[-2ex]
@ -402,62 +410,59 @@ Argument ist der Dateiname, und zuletzt muss das gew\"unschte Format
\end{minipage} \end{minipage}
\hfill \hfill
\begin{minipage}[t]{0.5\textwidth} \begin{minipage}[t]{0.5\textwidth}
Von \matlab{} unterst\"utzte Formate\footnote{mehr Information in der Hilfe zu \code{saveas()}}:\\[2ex] Formats supported by \matlab{} \footnote{more information can be
found in the documentation of \code{saveas()}}:\\[2ex]
\begin{tabular}{|l|c|l|} \begin{tabular}{|l|c|l|}
\hline \hline \textbf{format} & \textbf{type} & \code{saveas()} \textbf{argument}
\textbf{Format} & \textbf{Typ} & \code{saveas()} Argument \erh \\ \hline \erh \\ \hline pdf & vector & \varcode{'pdf'} \erb \\ eps &
pdf & Vektor & \varcode{'pdf'} \erb \\ vector & \varcode{'eps'}, \varcode{'epsc'} \\ SVG & vector &
eps & Vektor & \varcode{'eps'}, \varcode{'epsc'} \\ \varcode{'svg'} \\ PS & vector & \varcode{'ps'}, \varcode{'psc'}
SVG & Vektor & \varcode{'svg'} \\ \\ jpg & bitmap & \varcode{'jpeg'} \\ tif & bitmap &
PS & Vektor & \varcode{'ps'}, \varcode{'psc'} \\ \varcode{'tiff'}, \varcode{'tiffn'} \\ png & bitmap &
jpg & Bitmap & \varcode{'jpeg'} \\ \varcode{'png'} \\ bmp & bitmap & \varcode{'bmp'} \\ \hline
tif & Bitmap & \varcode{'tiff'}, \varcode{'tiffn'} \\
png & Bitmap & \varcode{'png'} \\
bmp & Bitmap & \varcode{'bmp'} \\ \hline
\end{tabular} \end{tabular}
\end{minipage} \end{minipage}
Wenn aus \matlab{} heraus Graphiken gespeichert werden sollen, dann It is often meaningful to store of data plots generated by \matlab{}
ist es meistens sehr sinnvoll sie als Vektorgraphik zu speichern. Im using a vector graphics format. When in doubt they can usually be
Zweifelsfall k\"onnen diese sp\"ater immer noch in Rastergraphiken easily converted to a bitmap format. The way from a bitmap to a
umgewandelt werden. Der Weg von einer Rastergraphik zu einer vector graphic is not possible without a loss in quality. Storing a
Vektorgraphik ist dagegen nicht verlustfrei m\"oglich. Das Speichern von plot that contains a very large set of graphical elements (e.g.\,a
Abbildungen mit sehr vielen graphischen Elementen (z.B. ein raster-plot showing thousands of action potentials) may, on the
Rasterplot mit tausenden von Aktionspotentialen) ist als other hand, lead to very large files that can be hard to
Rastergraphik allerdings deutlich schneller und speichereffizienter. handle. Saving such a plot using a bitmap format may be more
efficient.
\end{ibox} \end{ibox}
\lstinputlisting[caption={Skript zur Erstellung des Plots in \figref{spikedetectionfig}.}, label=niceplotlisting]{automatic_plot.m} \lstinputlisting[caption={Skript zur Erstellung des Plots in
\figref{spikedetectionfig}.},
label=niceplotlisting]{automatic_plot.m}
Neben den Standard-Linienplots gibt es eine ganze Reihe weiterer Next to the standard line plots there are many more options to display
M\"oglichkeiten Daten zu Visualisieren. Mathworks zeigt auf seiner scientific data. Mathworks shows various examples and the respective
Homepage viele Beispiele mit zugeh\"origem Code code on their website
\url{http://www.mathworks.de/discovery/gallery.html}. \url{http://www.mathworks.de/discovery/gallery.html}.
\section{Fazit} \section{Conclusion}
A good plot of scientific data displays the data completely and
Ein guter Datenplot stellt die Daten m\"oglichst vollst\"andig und seriously without too many distractions. Misleading or suggestive
n\"uchtern dar. Verzerrungen durch perspektivische Darstellungen, plots as may result from perspective presentations, inappropriate
Achs- oder Symbolskalierungen sollten vermieden werden. scaling of axes of symbols should be avoided.
Wenn verschiedene Linienplots in einen Graphen geplottet werden, \noindent When combining several line plots within the same figure one should
sollte neben der Farbe auch der Linienstil (durchgezogen, gepunktet, consider adapting color \texbf{and} line style (solid, dashed,
gestrichelt, etc.) variiert werden, um auch im Schwarz-Wei{\ss}-Druck dotted. etc.) to make the distinguishable even in black-and-white
eine Unterscheidung zu erm\"oglichen. prints. Combinations of red and green are no good choice since they
cannot be distinguished by people with red-green blindness.
Bei der Farbwahl sollte auf \vspace{2ex}
Kombinationen aus Rot und Gr\"un verzichtet werden, da sie f\"ur einen nicht Key ingredients for a good data plot:
unwesentlichen Teil der m\"annlichen Bev\"olkerung nicht
unterscheidbar sind.
Achte bei der Erstellung von Plots insbesondere auf:
\begin{itemize} \begin{itemize}
\item Klarheit. \item Clearness.
\item Vollst\"andige und lesbare Beschriftung. \item Complete labeling.
\item Deutliche Unterscheidbarkeit von Kurven. \item Plotted lines and curves must be distinguishable.
\item Keine suggestive Darstellung. \item No suggestive or misleading presentation.
\item Ausgewogenheit von Linienst\"arken, Schrift- und Plotgr\"o{\ss}e. \item The right balance of line width, font size and size of the figure.
\item Fehlerbalken, wenn sie angebracht sind. \item Error bars wherever they are appropriate.
\end{itemize} \end{itemize}