0

How can I get equal scaling? In the MWE I would like to have it so that the grid consists of squares.

\documentclass{article}

\usepackage{geometry}
\geometry{textwidth=150mm, textheight=270mm}

% Abbildungen erstellen, auch Graphen plotten
\usepackage{tikz}

%For environment axis
\usepackage{pgfplots}

\pgfplotsset{compat=1.13}

\begin{document}

\begin{center}

\begin{tikzpicture}
\begin{axis}[
    samples=60,
    domain=-10:10, xmax=11, ymin=-2, ymax=102,
    restrict y to domain=-2:121,
    axis lines=center,
    y=0.5cm/2.5,
    x=0.5cm,
    grid=both,
    xtick={-10,...,10},
    ytick={0,2,...,100},
    xlabel=$x$, xlabel style={at={(1,0)}, anchor=north},
    ylabel=$f(x)$, ylabel style={at={(0.52,1)}, anchor=north}
]
\addplot [style=ultra thick, blue, axis=equal] {x^2};
\end{axis}
\end{tikzpicture}
\end{center}

\end{document}

enter image description here

1
  • @hpekristiansen Yes, thanks. – ubuntuuser Nov 21 '20 at 15:34
1

In this case it should be

y=0.5cm/2,
x=0.5cm,

to get a square grid.

Not the answer you're looking for? Browse other questions tagged or ask your own question.