move plotting stuff to own folder

This commit is contained in:
2015-11-06 16:50:44 +01:00
parent 86978d4d41
commit 53d3e87442
23 changed files with 214 additions and 0 deletions

70
plotting/lecture/Makefile Normal file
View File

@@ -0,0 +1,70 @@
BASENAME=plotting
PYFILES=$(wildcard *.py)
PYPDFFILES=$(PYFILES:.py=.pdf)
GPTFILES=$(wildcard *.gpt)
GPTTEXFILES=$(GPTFILES:.gpt=.tex)
all: pdf slides thumbs
# script:
pdf : $(BASENAME)-chapter.pdf
$(BASENAME)-chapter.pdf : $(BASENAME)-chapter.tex $(BASENAME).tex $(GPTTEXFILES) $(PYPDFFILES)
pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true
# slides:
slides: $(BASENAME)-slides.pdf
$(BASENAME)-slides.pdf : $(BASENAME)-slides.tex $(GPTTEXFILES) $(PYPDFFILES)
pdflatex -interaction=scrollmode $< | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex -interaction=scrollmode $< || true
# thumbnails:
thumbs: $(BASENAME)-handout.pdf
$(BASENAME)-handout.pdf: $(BASENAME)-slides.tex $(GPTTEXFILES)
sed -e 's/setboolean{presentation}{true}/setboolean{presentation}{false}/; s/usepackage{crop}/usepackage[frame]{crop}/' $< > thumbsfoils.tex
pdflatex thumbsfoils | tee /dev/stderr | fgrep -q "Rerun to get cross-references right" && pdflatex thumbsfoils || true
pdfnup --nup 2x4 --no-landscape --paper a4paper --trim "-1cm -1cm -1cm -1cm" --outfile $@ thumbsfoils.pdf # 1-19
rm thumbsfoils.*
watchpdf :
while true; do ! make -q pdf && make pdf; sleep 0.5; done
watchslides :
while true; do ! make -q slides && make slides; sleep 0.5; done
# python plots:
$(PYPDFFILES) : %.pdf: %.py
python $<
# gnuplot plots:
$(GPTTEXFILES) : %.tex: %.gpt whitestyles.gp
gnuplot whitestyles.gp $<
epstopdf $*.eps
clean :
rm -f *~
rm -f $(BASENAME).aux $(BASENAME).log
rm -f $(BASENAME)-chapter.aux $(BASENAME)-chapter.log $(BASENAME)-chapter.out
rm -f $(BASENAME)-slides.aux $(BASENAME)-slides.log $(BASENAME)-slides.out $(BASENAME)-slides.toc $(BASENAME)-slides.nav $(BASENAME)-slides.snm $(BASENAME)-slides.vrb
rm -f $(PYPDFFILES) $(GPTTEXFILES)
cleanall : clean
rm -f $(BASENAME)-chapter.pdf $(BASENAME)-slides.pdf $(BASENAME)-handout.pdf
help :
@echo -e \
"make pdf: make the pdf file of the script.\n"\
"make slides: make the pdf file of the slides.\n"\
"make thumbs: make color thumbnails of the talk.\n"\
"make watchpdf: make the pdf file of the script\n"\
" whenever the tex file is modified.\n"\
"make watchpdf: make the pdf file of the slides\n"\
" whenever the tex file is modified.\n"\
"make clean: remove all intermediate files,\n"\
" just leave the source files and the final .pdf files.\n"\
"make cleanup: remove all intermediate files as well as\n"\
" the final .pdf files.\n"\

View File

@@ -0,0 +1,61 @@
% Copyright 2007 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/licenses/LICENSE for more details.
\usepackage{color}
\definecolor{karminrot}{RGB}{165,30,55}
\definecolor{gold}{RGB}{180,160,105}
\definecolor{anthrazit}{RGB}{50 ,65 ,75 }
\mode<presentation>
\setbeamercolor*{normal text}{fg=anthrazit,bg=white}
\setbeamercolor*{alerted text}{fg=anthrazit}
\setbeamercolor*{example text}{fg=anthrazit}
\setbeamercolor*{structure}{fg=gold,bg=karminrot}
\providecommand*{\beamer@bftext@only}{%
\relax
\ifmmode
\expandafter\beamer@bftext@warning
\else
\expandafter\bfseries
\fi
}
\providecommand*{\beamer@bftext@warning}{%
\ClassWarning{beamer}
{Cannot use bold for alerted text in math mode}%
}
\setbeamerfont{alerted text}{series=\beamer@bftext@only}
\setbeamercolor{palette primary}{fg=karminrot,bg=white}
\setbeamercolor{palette secondary}{fg=gold,bg=white}
\setbeamercolor{palette tertiary}{fg=anthrazit,bg=white}
\setbeamercolor{palette quaternary}{fg=black,bg=white}
\setbeamercolor{sidebar}{bg=karminrot!100}
\setbeamercolor{palette sidebar primary}{fg=karminrot}
\setbeamercolor{palette sidebar secondary}{fg=karminrot}
\setbeamercolor{palette sidebar tertiary}{fg=karminrot}
\setbeamercolor{palette sidebar quaternary}{fg=karminrot}
\setbeamercolor{item projected}{fg=black,bg=black!20}
\setbeamercolor*{block body}{}
\setbeamercolor*{block body alerted}{}
\setbeamercolor*{block body example}{}
\setbeamercolor*{block title}{parent=structure}
\setbeamercolor*{block title alerted}{parent=alerted text}
\setbeamercolor*{block title example}{parent=example text}
\setbeamercolor*{titlelike}{parent=structure}
\mode
<all>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

View File

@@ -0,0 +1,17 @@
\documentclass[12pt]{report}
\input{../../header}
\lstset{inputpath=../code}
\graphicspath{{images/}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\include{psth_sta}
\end{document}

View File

@@ -0,0 +1,358 @@
\documentclass{beamer}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{pgf}
%\usepackage{pgf,pgfarrows,pgfnodes,pgfautomata,pgfheaps,pgfshade}
%\usepackage{multimedia}
\usepackage[english]{babel}
\usepackage{movie15}
\usepackage[latin1]{inputenc}
\usepackage{times}
\usepackage{amsmath}
\usepackage{bm}
\usepackage[T1]{fontenc}
\usepackage[scaled=.90]{helvet}
\usepackage{scalefnt}
\usepackage{tikz}
\usepackage{ textcomp }
\usepackage{soul}
\usepackage{hyperref}
\definecolor{lightblue}{rgb}{.7,.7,1.}
\definecolor{mygreen}{rgb}{0,1.,0}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\mode<presentation>
{
\usetheme{Singapore}
\setbeamercovered{opaque}
\usecolortheme{tuebingen}
\setbeamertemplate{navigation symbols}{}
\usefonttheme{default}
\useoutertheme{infolines}
% \useoutertheme{miniframes}
}
\AtBeginSection[]
{
\begin{frame}<beamer>
\begin{center}
\Huge \insertsectionhead
\end{center}
% \frametitle{\insertsectionhead}
% \tableofcontents[currentsection,hideothersubsections]
\end{frame}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
\setbeamertemplate{blocks}[rounded][shadow=true]
\title[]{Scientific Computing -- Grundlagen der Programmierung }
\author[]{Jan Grewe\\Abteilung f\"ur Neuroethologie\\
Universit\"at T\"ubingen}
\institute[Wissenschaftliche Datenverarbeitung]{}
\date{12.10.2015 - 06.11.2015}
%\logo{\pgfuseimage{../../resources/UT_BM_Rot_RGB.pdf}}
\subject{Einf\"uhrung in die wissenschaftliche Datenverarbeitung}
\vspace{1em}
\titlegraphic{
\includegraphics[width=0.5\linewidth]{../../resources/UT_WBMW_Rot_RGB}
}
%%%%%%%%%% configuration for code
\lstset{
basicstyle=\ttfamily,
numbers=left,
showstringspaces=false,
language=Matlab,
commentstyle=\itshape\color{darkgray},
keywordstyle=\color{blue},
stringstyle=\color{green},
backgroundcolor=\color{blue!10},
breaklines=true,
breakautoindent=true,
columns=flexible,
frame=single,
captionpos=b,
xleftmargin=1em,
xrightmargin=1em,
aboveskip=10pt
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\mycite}[1]{
\begin{flushright}
\tiny \color{black!80} #1
\end{flushright}
}
\newcommand{\code}[1]{\texttt{#1}}
\input{../../latex/environments.tex}
\makeatother
\begin{document}
\begin{frame}[plain]
\frametitle{}
\vspace{-1cm}
\titlepage % erzeugt Titelseite
\end{frame}
\begin{frame}
\frametitle{Grundlagen der Programmierung}
\frametitle{Inhalt}
\begin{enumerate}
\item Graphische Darstellung von Daten
\end{enumerate}
\end{frame}
\begin{frame}[plain]
\huge{1. Graphische Darstellung von Daten}\pause
\begin{figure}
\includegraphics[width=0.9\columnwidth]{images/convincing}
\end{figure}
\end{frame}
\begin{frame}
\frametitle{Graphische Darstellung von Daten}
\framesubtitle{Was soll ein Datenplot erreichen?}
\begin{itemize}
\item Ist eine m\"oglichst neutrale Darstellung der Daten.
\item Soll dem Leser die Daten greifbar machen und die Aussagen der
Analyse darstellen.
\item Erlaubt dem Leser die gezeigten Effekte selbst zu beguachten
und zu validieren.
\item Muss vollst\"andig annotiert sein.
\item Folgt dem Prinzip der \textbf{ink minimization}. (Das
Verh\"altnis aus Tinte, die f\"ur die Darstellung der Daten
gebraucht wird und der Menge Tinte, die f\"ur die Graphik
ben\"otigt wird sollte m\"oglichst gro{\ss} sein )
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Graphische Darstellung von Daten}
\framesubtitle{Was sollte vermieden werden?}
\begin{itemize}
\item Suggestive oder gar fehlleitende Darstellung.
\item Ablenkung durch unruhige oder \"uberm\"a{\ss}ige Effekte.
\item Comicartige Effekte...
\end{itemize}\pause
\begin{figure}
\includegraphics[width=0.35\columnwidth]{images/one_d_problem_c}
\end{figure}\pause
... aus{\ss}er sie werden rein zur Illustration benutzt ohne einen
Anspruch auf Richtigkeit zu erheben.
\end{frame}
\begin{frame}
\frametitle{Graphische Darstellung von Daten}
\framesubtitle{Suboptimale Beispiele}
\only <1> {
\begin{figure}
\includegraphics[width=0.5\columnwidth]{images/nobelbad}
\end{figure}
\vspace{0.25cm}
Aus Hafting et al., Nature, 2005
}
\only <2> {
\begin{figure}
\includegraphics[width=0.7\columnwidth]{images/misleading_pie}
\end{figure}
\vspace{0.5cm}
\url{https://en.wikipedia.org/wiki/Misleading_graph}
}
\only <3> {
\begin{figure}
\includegraphics[width=0.7\columnwidth]{images/sample_pie}
\end{figure}
\vspace{0.5cm}
\url{https://en.wikipedia.org/wiki/Misleading_graph}
}
\only <4> {
\begin{figure}
\includegraphics[width=0.3\columnwidth]{images/badbarright}
\end{figure}
\vspace{0.5cm}
\url{https://en.wikipedia.org/wiki/Misleading_graph}
}
\only <5> {
\begin{figure}
\includegraphics[width=0.3\columnwidth]{images/badbarleft}
\end{figure}
\vspace{0.5cm}
\url{https://en.wikipedia.org/wiki/Misleading_graph}
}
\only <6> {
\begin{figure}
\includegraphics[width=0.8\columnwidth]{images/badbarplot}
\end{figure}
\vspace{0.5cm}
\url{https://en.wikipedia.org/wiki/Misleading_graph}
}
\only <7> {
Wahl der Zeichenfl\"ache kann den visuellen Eindruck beeinflu{\ss}en.
\begin{columns}
\begin{column}{4.cm}
\begin{figure}
\includegraphics[width=0.7\columnwidth]{images/line_graph1}
\end{figure}
\end{column}
\begin{column}{4.cm}
\begin{figure}
\includegraphics[width=0.7\columnwidth]{images/line_graph1_3}
\end{figure}
\end{column}
\begin{column}{4.cm}
\begin{figure}
\includegraphics[width=0.7\columnwidth]{images/line_graph1_4}
\end{figure}
\end{column}
\end{columns}
\vspace{0.5cm}
\url{https://en.wikipedia.org/wiki/Misleading_graph}
}
\only <8> {
Vorsicht bei der Skalierung von Symbolen!
\begin{columns}
\begin{column}{4.cm}
\begin{figure}
\includegraphics[width=0.7\columnwidth]{images/improperly_scaled_graph}
\end{figure}
\end{column}
\begin{column}{4.cm}
\begin{figure}
\includegraphics[width=0.7\columnwidth]{images/properly_scaled_graph}
\end{figure}
\end{column}
\begin{column}{4.cm}
\begin{figure}
\includegraphics[width=0.7\columnwidth]{images/comparison_properly_improperly_graph}
\end{figure}
\end{column}
\end{columns}
\vspace{0.5cm}
\url{https://en.wikipedia.org/wiki/Misleading_graph}
}
\end{frame}
\begin{frame}[fragile]
\frametitle{Graphische Darstellung von Daten}
\framesubtitle{Plotting Interfaces in Matlab}
Es gibt zwei Wege Graphen zu bearbeiten:
\begin{enumerate}
\item Interaktiv \"uber das \textit{graphische User Interface}\pause
\item Die Kommandozeile bzw. in Skripten und Funktionen.\pause
\end{enumerate}
Beides hat seine Berechtigung und seine eigenen Vor- und Nachteile. Welche?
\end{frame}
\begin{frame}
\frametitle{Graphische Darstellung von Daten}
\framesubtitle{Ver\"anderung des Graphen \"uber die Kommandozeile}
\begin{itemize}
\item Erstellt ein Skript, dass einen Plot erstellt.
\item Dieser soll zwei Sinus unterschiedlicher Frequenz darstellen.
\end{itemize}
Wir werden jetzt die Kommandozeil bzw. das Skript verbessern um den
Plot ``sch\"oner'' zu machen.
\end{frame}
\begin{frame}
\frametitle{Graphische Darstellung von Daten}
\framesubtitle{Ver\"anderung des Graphen \"uber die Kommandozeile}
\begin{enumerate}
\item Einstellungen der Linienplots:
\begin{itemize}
\item St\"arke und Farbe.
\item Linienstil, Marker.
\end{itemize}\pause
\item Achsbeschriftung:
\begin{itemize}
\item \code{xlabel}, \code{ylabel}.
\item Schriftart und Gr\"o{\ss}e.
\end{itemize}\pause
\item Achsenskalierung und Ticks:
\begin{itemize}
\item Skalierung der Achsen (Minumum und Maxmimum, logarithmisch oder linear).
\item Manuelles Setzen der Ticks, ihrer Richtung und Beschriftung.
\item Grid or no Grid?
\end{itemize}\pause
\item Setzen von globalen Parametern:
\begin{itemize}
\item Einstellung der Papiergr\"o{\ss}e und plzieren der
Zeichenfl\"ache.
\item Box oder nicht?
\item Speichern der Abbildung als pdf.
\end{itemize}
\end{enumerate}
\end{frame}
\begin{frame} [fragile]
\frametitle{Graphische Darstellung von Daten}
\framesubtitle{Ver\"andern von Eigenschaften \"uber die Kommandozeile}
\vspace{-0.75em}
\scriptsize
\begin{lstlisting}
fig = figure();
set(gcf, 'PaperUnits', 'centimeters', 'PaperSize', [11.7 9.0]);
set(gcf, 'PaperPosition',[0.0 0.0 11.7 9.0], 'Color', 'white')
hold on
plot(time, neuronal_data, 'color', [ 0.2 0.5 0.7], 'linewidth', 1.)
plot(spike_times, ones(size(spike_times))*threshold, 'ro', 'markersize', 4)
line([time(1) time(end)], [threshold threshold], 'linestyle', '--',
'linewidth', 0.75, 'color', [0.9 0.9 0.9])
ylim([0 35])
xlim([0 2.25])
box('off')
xlabel('time [s]', 'fontname', 'MyriadPro-Regular', 'fontsize', 10)
ylabel('potential [mV]', 'fontname', 'MyriadPro-Regular', 'fontsize', 10)
title('pyramidal cell', 'fontname', 'MyriadPro-Regular', 'fontsize', 12)
set(gca, 'TickDir','out', 'linewidth', 1.5, 'fontname', 'MyriadPro-Regular')
saveas(fig, 'spike_detection.pdf', 'pdf')
\end{lstlisting}
\end{frame}
\begin{frame} [fragile]
\frametitle{Graphische Darstellung von Daten}
\framesubtitle{Ver\"andern von Eigenschaften \"uber die Kommandozeile}
\begin{figure}
\centering
\includegraphics[width=0.75\columnwidth]{./images/spike_detection}
\end{figure}
\end{frame}
\begin{frame} [fragile]
\frametitle{Graphische Darstellung von Daten}
\framesubtitle{Welche Art Plot wof\"ur?}
\url{http://www.mathworks.de/discovery/gallery.html}
\end{frame}
\begin{frame} [fragile]
\frametitle{Graphische Darstellung von Daten}
\framesubtitle{Was macht einen guten Abbildung aus?}
\begin{enumerate}
\item Klarheit.
\item Vollstaendige 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.
\end{enumerate}
\end{frame}
\end{document}

View File

@@ -0,0 +1,11 @@
\chapter{\tr{Data plotting}{Graphische Darstellung von Daten}}
\section{Graphische Darstellung von Daten}
\begin{figure}
\includegraphics[width=0.9\columnwidth]{convincing}
\caption{Die Folgen schlecht annotierter
Plots. \url{www.xkcd.com}} \label{xkcdplotting}
\end{figure}