# Scaling a whole plot

Have a plot diagram with x and y axis and i want to scale it such as stratching.

How do i do that?

\begin{tikzpicture}
\begin{axis}[
axis lines = left,
xlabel = $x$]
%Below the red parabola is defined

%Here the blue parabloa is defined
domain=0:9.5,
samples=700,
color=blue,
]
{sin(deg(x))};
\label{$sin((x))$}
domain=0:9.5,
samples=700,
color=blue,
]
{cos(deg(2*x))};
\addlegendentry{$cos(2x)$}
domain=0:9.5,
samples=700,
color=blue,
]
{sin(deg(2*x))};
\addlegendentry{$sin(2x)$}
domain=0:9.5,
samples=700,
color=blue,
]
{cos(deg(x))};
\addlegendentry{$cos(x)$}

\end{axis}
\end{tikzpicture}

• Do not stretch the plot. Just use \pgfplotsset{width=...,height=...} to get the desired dimensions. You can also add width=...,height=... to the options of the axis. The problem is here, like in some of the questions before, that you do not provide a complete document. So it is hard to write an explicit answer. The choices depend on what you use in your document. – Schrödinger's cat Nov 12 at 1:52

The proper way to stretch a pgf plot is to increase its width. (Also, as Torbjørn T. told you, it is better to write \sin to typeset a sine function.)

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16} %<- you may want to add this

\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines = left,
xlabel = $x$]
%Below the red parabola is defined

%Here the blue parabloa is defined
domain=0:9.5,
samples=700,
color=blue,
]
{sin(deg(x))};
\label{$sin((x))$} %<- dangerous practice
domain=0:9.5,
samples=700,
color=blue,
]
{cos(deg(2*x))};
\addlegendentry{$\cos(2x)$}
domain=0:9.5,
samples=700,
color=blue,
]
{sin(deg(2*x))};
\addlegendentry{$\sin(2x)$}
domain=0:9.5,
samples=700,
color=blue,
]
{cos(deg(x))};
\addlegendentry{$\cos(x)$}

\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
axis lines = left,
xlabel = $x$]
%Below the red parabola is defined

%Here the blue parabloa is defined
domain=0:9.5,
samples=700,
color=blue,
]
{sin(deg(x))};
\label{sin-2} %<- less dangerous
domain=0:9.5,
samples=700,
color=blue,
]
{cos(deg(2*x))};
\addlegendentry{$\cos(2x)$}
domain=0:9.5,
samples=700,
color=blue,
]
{sin(deg(2*x))};
\addlegendentry{$\sin(2x)$}
domain=0:9.5,
samples=700,
color=blue,
]
{cos(deg(x))};
\addlegendentry{$\cos(x)$}

\end{axis}
\end{tikzpicture}

\end{document}


As you can see, the second plot is "stretched" because the width was increased and the height decreased.