I'd like to plot a curve in a tikzpicture environment, but with non-orthonormal axis : i want the whole plot to fit inside a square, without clipping it.

I have been working on this example so far:

        \draw [thick,->] (-1,0)--(4,0) node [below] {$x$};
        \draw [thick,->] (0,-1)--(0,13*0.4) node [left] {$y$};
        \foreach \x in {1,...,3}
            \draw [very thick] (\x,2pt)--(\x,-2pt) node [below,black] {\small \x};
        \foreach \y in {1,...,12}
            \draw [very thick] (2pt,{\y*0.4})--(-2pt,{\y*0.4}) node [left,black] {\small \y};
        \draw [very thick, domain=-0.7:3.3, samples=200,yscale=0.4] plot (\x,{(\x)^2});

This code plots a square function between -0.7 and 3.3. In order to get the square function to be drawn in a square-ish plot I multiplied all y coordinates by 0.4. I could define a constant and multiply all the y coordinates by 0.4 along with the yscale of the plot ; but it feels very redundant to me to have to do it on everything I want to draw on the plot. Adding [yscale=0.4] to the tikzpicture is not a good solution since it will scale everything, and therefore squeeze the whole graph (the ticks will get squeezed on the y axis for example).

To sum it up, is there a way to tell that in a tikzpicture, mutiply all the coordinates of everything that has to be drawn by a certain amount ?

  • Welcome to TeX:SE! If you like to have different scale for x and y axis, than use ˙xscale=...` and yscale=.... Or do I miss understand your problem?
    – Zarko
    Oct 16, 2020 at 22:03
  • Well there is an issue with addone yscale, being that every object's size will be reduced. This will include the length of the individual ticks on the x-axis : i want them to be 2pt long ; if i add yscale=0.4, then they'll be 2*0.4=0.8pt long instead. So I'd have to correct their individual size. And if I want to add other objects, circles for example, their size will also be scaled and I'll get ellipses instead of circles on the graph. So using yscale, i'd have to manually scale other objects' sizes like ticks or other objects that i'd draw.
    – Jambon
    Oct 16, 2020 at 22:26
  • There is no issue, if you in writing of code accordingly. See my answer below.
    – Zarko
    Oct 17, 2020 at 5:30

1 Answer 1


Well, I guessing, that you looking for something like this:

\documentclass[tikz, margin=3.14159]{standalone}

\def\XS{2},   % set your scale factor ...
\def\YS{0.5}, % set your scale factor ...
xscale=\XS, yscale=\YS,
    > = Straight Barb
% axis
\draw[->] (-1,0) -- (4, 0) node [below] {$x$};
\draw[->] (0,-1) -- (0,12) node [left] {$y$};
% x ticks
\foreach \x in {1,...,3}
    \draw  (\x,2/\YS pt) -- (\x,-2/\YS pt) node [below, font=\small]  {\x}; % this lines should not be scaled ...
% y ticks
\foreach \y in {1,...,11}
    \draw (2/\XS pt,\y) -- (-2/\XS pt,\y) node [left, font=\small]    {\y}; % this lines should not be scaled ...
% parabola /segment/
\draw [thick, red, domain=-0.7:3.3, samples=100] plot (\x,\x*\x);

enter image description here

However, such drawing of function is simpler to draw using pgfplots package, where instead scaling you simple define width and height of diagram. For example:


\begin{axis}[width=6cm, height=6cm,
axis lines=middle,
xmin=-1, xmax=4,  xtick={1,2,3},
xlabel=$x$, xlabel style = {anchor=north east},
ymin=-1, ymax=12, ytick={1,2,...,11},
ylabel=$y$, ylabel style = {anchor=north west},
tick label style={font=\scriptsize},
\addplot +[domain=-0.7:3.3, samples=100, thick, no marks] {x*x};

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .