Skip to content
Snippets Groups Projects
examplePlot.tex 1.17 KiB
Newer Older
  • Learn to ignore specific revisions
  • \documentclass{HsH-standalone}
    
    Jan Wille's avatar
    Jan Wille committed
    
    
    
    Jan Wille's avatar
    Jan Wille committed
    \usepackage{siunitx} % SI units
    \usepackage{amsmath} % nice formulas
    
    Jan Wille's avatar
    Jan Wille committed
    
    
    Jan Wille's avatar
    Jan Wille committed
    \usepackage{pgfplots} % plots und bilder, includes tikz and graphix
    \usepackage{pgfplotstable} % fo ruse of tables, csv files are tables
    
    \begin{document} %----------------------Content---------------------------------------------------%
    
    Jan Wille's avatar
    Jan Wille committed
    
    \begin{tikzpicture}
    
    Jan Wille's avatar
    Jan Wille committed
    	\begin{axis}[MyPlots] % use custom styling
    
    Jan Wille's avatar
    Jan Wille committed
    		\addplot[FM1,domain=-1:1, name path=A]{x^2};
    		\addplot[FM2,mark=none,domain=-1:1, name path=B]{0.5*x^2-1};
    		\addplot[pattern color=gray!40, pattern=dots] fill between[of=A and B];
    
    Jan Wille's avatar
    Jan Wille committed
    	\end{axis}
    \end{tikzpicture}
    
    \begin{tikzpicture}
    
    Jan Wille's avatar
    Jan Wille committed
    	\pgfplotstableread{../csv/bsp.csv}\data % read file into macro
    	\begin{axis}[
    			MyPlots, % custom styling
    			xlabel=X Achse,
    			ylabel=$\percent$,
    
    Jan Wille's avatar
    Jan Wille committed
    		]
    		\addplot[FM1,errBars] table [x=A,y=C,y error=D] {\data};
    			\addlegendentry{Messdaten}
    		\addplot[FM2,smooth] table [x=A,y=C] {\data};
    			\addlegendentry{theroretische Werte}
    		\addplot[FM4] table [x=A,y={create col/linear regression={y=C}}] {\data};
    			\addlegendentry{lineariesiert zu: $y=\num\pgfplotstableregressiona*x+\num\pgfplotstableregressionb$}
    	\end{axis}
    \end{tikzpicture}
    
    \end{document}