What I'm looking for
I am using TikZ to create a cheatsheet that is intended to be used for practicing handwriting. I want to use sine waves as a pattern for practicing handwriting, so I want to display horizontal and vertical sine waves in the same page. In the cheatsheet I am creating, I want to draw a group of horizontal sine waves that go from one end of the sheet to the other end and that are very close. Below that group, I want to draw a group of vertical sine waves. I created the following graphic using Inkscape to show what I'm looking for.
What I've tried
I know how to draw horizontal sine waves using TikZ. See minimal working example below.
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[opacity=0.2] (0,0) grid (10,2);
\draw[red] (0,1) sin (1, 2);
\draw[blue] (1,2) cos (2, 1);
\draw[red] (2,1) sin (3, 0);
\draw[blue] (3,0) cos (4, 1);
\draw[red] (4,1) sin (5, 2);
\draw[blue] (5,2) cos (6, 1);
\draw[red] (6,1) sin (7, 0);
\draw[blue] (7,0) cos (8, 1);
\draw[red] (8,1) sin (9, 2);
\draw[blue] (9,2) cos (10,1);
\end{tikzpicture}
\end{document}
In order to create a vertical sine wave I tried using sin and cos and specify coordinates one after the other. However, given the nature of sin and cos functions, this doesn't look as smooth as the first graphic.
%% This file is intended to be compiled by executing the following
%% commands:
%% $ pdflatex main
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[opacity=0.2] (0,2) grid (10,-10);
% Horizontal sine wave
\draw[red] (0,1) sin (1, 2);
\draw[blue] (1,2) cos (2, 1);
\draw[red] (2,1) sin (3, 0);
\draw[blue] (3,0) cos (4, 1);
\draw[red] (4,1) sin (5, 2);
\draw[blue] (5,2) cos (6, 1);
\draw[red] (6,1) sin (7, 0);
\draw[blue] (7,0) cos (8, 1);
\draw[red] (8,1) sin (9, 2);
\draw[blue] (9,2) cos (10,1);
% My attempt to draw a vertical sine wave (the result is not a
% vertical sine wave)
\draw[red] (1,-0) cos (2,-1);
\draw[blue] (2,-1) sin (1,-2);
\draw[red] (1,-2) cos (0,-3);
\draw[blue] (0,-3) sin (1,-4);
\draw[red] (1,-4) cos (2,-5);
\draw[blue] (2,-5) sin (1,-6);
\draw[red] (1,-6) cos (0,-7);
\draw[blue] (0,-7) sin (1,-8);
\draw[red] (1,-8) cos (2,-9);
\draw[blue] (2,-9) sin (1,-10);
\end{tikzpicture}
\end{document}
The question
How to display a vertical sine wave below an horizontal sine wave in the same tikzpicture environment?
The answer doesn't need to be the code for the first graphic, which I created using Inkscape, shown above. A vertical sine wave below an horizontal sine wave in the same tikzpicture environment would be enough.




% Vertical sine waveto% My attempt to draw a vertical sine wave (the result is not a % vertical sine wave)– rdrg109 Feb 29 '24 at 03:20