Deformation of rectangular plot

Can I deform a rectangular plot to a curved plot like \documentclass[tikz, border=0.5cm]{standalone}

\begin{document}

\begin{tikzpicture}
\draw[red] (0,0) grid (5,5);
\draw[->, black] (0,0) -- +(5,0);
\draw[->, black] (0,0) -- +(0,5);
\end{tikzpicture}

\end{document}

Yes, with nonlinear transformations.

\documentclass[tikz, border=0.5cm]{standalone}
\usepgfmodule{nonlineartransformations}
\makeatletter
\def\latticetilt{%
\pgf@xa=\pgf@x%
\pgf@ya=\pgf@y%
%\typeout{old\space x=\pgf@xa\space old \space y=\pgf@ya}%
\pgfmathsetmacro{\myx}{\pgf@xa+\pgfkeysvalueof{/tikz/lattice/amplitude}*sin((\pgf@ya/\pgfkeysvalueof{/tikz/lattice/spacing})*360/\pgfkeysvalueof{/tikz/lattice/superlattice period})}%
\pgf@x=\myx pt%
\pgfmathsetmacro{\myy}{\pgf@ya+\pgfkeysvalueof{/tikz/lattice/amplitude}*sin((\pgf@xa/\pgfkeysvalueof{/tikz/lattice/spacing})*360/\pgfkeysvalueof{/tikz/lattice/superlattice period})}%
%\typeout{at\space x=\the\pgf@xa:\space new\space y=\myy}%
\pgf@y=\myy pt}
\begin{document}

\begin{tikzpicture}[lattice/.cd,spacing/.initial=5,superlattice
period/.initial=30,amplitude/.initial=3]
\begin{scope}[xshift=-6cm]
\draw[red] (0,0) grid (5,5);
\draw[->, black] (0,0) -- +(5,0);
\draw[->, black] (0,0) -- +(0,5);
\end{scope}
\begin{scope}
\pgftransformnonlinear{\latticetilt}
\draw[red] (0,0) grid (5,5);
\draw[->, black] (0,0) -- +(5,0);
\draw[->, black] (0,0) -- +(0,5);
\end{scope}
\end{tikzpicture}
\end{document} The way that works is that you install a transformation, in this case \latticetilt that transforms the x and y coordinates, \pgf@x and \pgf@y. You need to write this in the somewhat cryptic TeX syntax. (This is not absolutely necessary, it is not too difficult to write something less cryptic, but then the compilation may take longer.) The reason for the name superlattice is that I copied this transformation from here, and there it was a small variation of this one. This animation illustrates what the amplitude key does. (It also has a pic for the coordinate system such that you need to change the code only once if you want to have the untransformed and the transformed pics side by side.)

\documentclass[tikz, border=0.5cm]{standalone}
\usepgfmodule{nonlineartransformations}
\makeatletter
\def\latticetilt{%
\pgf@xa=\pgf@x%
\pgf@ya=\pgf@y%
%\typeout{old\space x=\pgf@xa\space old \space y=\pgf@ya}%
\pgfmathsetmacro{\myx}{\pgf@xa+\pgfkeysvalueof{/tikz/lattice/amplitude}*sin((\pgf@ya/\pgfkeysvalueof{/tikz/lattice/spacing})*360/\pgfkeysvalueof{/tikz/lattice/superlattice period})}%
\pgf@x=\myx pt%
\pgfmathsetmacro{\myy}{\pgf@ya+\pgfkeysvalueof{/tikz/lattice/amplitude}*sin((\pgf@xa/\pgfkeysvalueof{/tikz/lattice/spacing})*360/\pgfkeysvalueof{/tikz/lattice/superlattice period})}%
%\typeout{at\space x=\the\pgf@xa:\space new\space y=\myy}%
\pgf@y=\myy pt}
\tikzset{pics/.cd,cs/.style={code={
\draw[red] (0,0) grid (#1,#1);
\draw[stealth-stealth, thick] (0,#1) |- (#1,0);
\draw[->, black] (0,0) -- +(0,5);
}},cs/.default=5}
\begin{document}
\foreach \X in {1,...,8,7,6,...,2}
{\begin{tikzpicture}[lattice/.cd,spacing/.initial=5,superlattice
period/.initial=30,amplitude/.initial=\X]
\path[use as bounding box] (-7.1,-0.1) rectangle (5.1,5.1);
\begin{scope}[xshift=-7cm]
\pic{cs};
\end{scope}
\begin{scope}
\pgftransformnonlinear{\latticetilt}
\pic{cs};
\end{scope}
\draw[very thick,-latex] (-1.9,2.5) -- (-0.1,2.5);
\end{tikzpicture}}
\end{document} Note, however, that nonlinear transformations are nonlinear. In particular, if you move the stuff around, it will change its shape. And you can run into dimension too large problems and so on, but this is also true for decorations etc.

• +1: I assume that you have a background in mathematics?! – Dr. Manuel Kuehner Jun 2 at 14:15
• @Dr.ManuelKuehner A little bit. ;-) – user121799 Jun 2 at 14:18
• @Dr.ManuelKuehner marmot he's a very humble magician. :-) – Sebastiano Jun 2 at 14:52