Created
December 16, 2014 09:59
-
-
Save kaspersoerensen/0d39363847dd8623884e to your computer and use it in GitHub Desktop.
Til brug med PGFplots
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Use this package to plots from MATLAB | |
\usepackage{pgfplots} | |
\definecolor{blue}{rgb}{ 0 0.4470 0.7410} | |
\definecolor{red}{rgb}{0.6350 0.0780 0.1840} | |
\definecolor{orange}{rgb}{0.8500 0.3250 0.0980} | |
\definecolor{yellow}{rgb}{0.9290 0.6940 0.1250} | |
\definecolor{purple}{rgb}{ 0.4940 0.1840 0.5560} | |
\definecolor{green}{rgb}{ 0.4660 0.6740 0.1880} | |
\pgfplotsset{compat=1.5.1} | |
\usepackage{tikz} | |
\usepgfplotslibrary{external} | |
\tikzexternalize[prefix=tikz/] | |
\usetikzlibrary{decorations.markings} | |
\usetikzlibrary{pgfplots.groupplots} | |
\usetikzlibrary{arrows,shapes,positioning,angles,spy} | |
\usepackage{pgfplotstable} | |
% Style to select only points from #1 to #2 (inclusive) | |
\pgfplotsset{select coords between index/.style 2 args={ | |
x filter/.code={ | |
\ifnum\coordindex<#1\def\pgfmathresult{}\fi | |
\ifnum\coordindex>#2\def\pgfmathresult{}\fi | |
} | |
}} | |
\pgfplotsset{ylabsh/.style={every axis y label/.style={at={(0,0.5)}, xshift=#1, rotate=90}}} | |
\makeatletter | |
\pgfplotsset{ | |
groupplot xlabel/.initial={}, | |
every groupplot x label/.style={ | |
at={($({\pgfplots@group@name\space c1r\pgfplots@[email protected]}|-{\pgfplots@group@name\space c1r\pgfplots@[email protected] south})!0.5!({\pgfplots@group@name\space c\pgfplots@group@columns r\pgfplots@[email protected]}|-{\pgfplots@group@name\space c\pgfplots@group@columns r\pgfplots@[email protected] south})$)}, | |
anchor=north, | |
}, | |
groupplot ylabel/.initial={}, | |
every groupplot y label/.style={ | |
rotate=90, | |
at={($({\pgfplots@group@name\space c1r1.north}-|{\pgfplots@group@name\space c1r1.outer | |
west})!0.5!({\pgfplots@group@name\space c1r\pgfplots@[email protected]}-|{\pgfplots@group@name\space c1r\pgfplots@[email protected] west})$)}, | |
anchor=south | |
}, | |
execute at end groupplot/.code={% | |
\node [/pgfplots/every groupplot x label] | |
{\pgfkeysvalueof{/pgfplots/groupplot xlabel}}; | |
\node [/pgfplots/every groupplot y label] | |
{\pgfkeysvalueof{/pgfplots/groupplot ylabel}}; | |
} | |
} | |
\def\endpgfplots@environment@groupplot{% | |
\endpgfplots@environment@opt% | |
\pgfkeys{/pgfplots/execute at end groupplot}% | |
\endgroup% | |
} | |
\makeatother |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment