Ich habe für mich eine gangbare Lösung gefunden. Ist zwar nicht so flexibel, aber funktioniert und ich habe die Probleme umschifft. Schön wäre aber trotzdem, wenn ich die Skalierung der Achsen flexibler gestalten könnte. Vielleicht kann mir dahingehend ja jemand einen Tipp geben. Vielen Dank im Voraus!
Code:
\documentclass[margin=5pt]{standalone}
\usepackage{tikz}
\newcommand\koordinaten[4]{
\def\xmin{#1}
\def\ymin{#2}
\def\xmax{#3}
\def\ymax{#4}
\draw [step=0.2, help lines] (\xmin,\ymin) grid (\xmax,\ymax);
\draw [->,very thick] (\xmin,0) -- (\xmax,0);
\draw [->,very thick] (0,\ymin) -- (0,\ymax);
% Achsen beschriften
\foreach \x in {\xmin,\the\numexpr\xmin+1\relax,...,\the\numexpr\xmax-1\relax}
\draw (\x,-0.1) -- (\x,0) node[below=4pt,fill=white] {$\scriptstyle \x$};
\foreach \y in {\ymin,\the\numexpr\ymin+1\relax,...,\the\numexpr\ymax-1\relax}
\draw (-0.1,\y) -- (0,\y) node[left=4pt,fill=white] {$\scriptstyle \y$};
\node[above right] at (\xmax,0) {$x$};
\node[above right] at (0,\ymax) {$y$};
}
\begin{document}
\begin{tikzpicture}
\koordinaten{-2}{-2}{6}{6}
\end{tikzpicture}
\end{document}
Lesezeichen