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