When I want to draw a rectangle on the xy axes, I need to multiply all the digits by ten. What am I doing wrong?

\documentclass[symmetric,justified,a4paper]{tufte-book} % use larger type; default would be 10pt

\usepackage[utf8]{inputenc} % set input encoding (not needed with XeLaTeX)
\usepackage{amsmath,units} %voor wiskundige formules
\usepackage[decimalsymbol=comma,per-mode=fraction,exponent-product = \cdot]{siunitx}
\sisetup{load-configurations = abbreviations}

\begin{tikzpicture}[scale=1, transform shape]
title=$F(\Delta x)$-grafiek,
major grid style=gray,
axis lines=center,
xmin=0, xmax=10,
ymin=0, ymax=25,
xlabel=$\Delta x(\si{\m})$,
minor xtick={0,1,...,10},
minor ytick={0,1,...,25},
%enlarge x limits={upper},
%enlarge y limits={upper}
\addplot[red, very thick, domain=0:8]  {20} node[above]{$F$};
\filldraw[fill opacity=.3,fill=orange] (0,0) rectangle (80,200) ;

As you see the dimensions of the rectangle should be (8,20) and not (80,200)

enter image description here

1 Answer 1


PGFPLOTS version < 1.11

Seems like your PGFPLOTS version is < 1.11. So you should use:

rectangle (axis cs:8,20)

instead of

rectangle (80,200).

PGFPLOTS version >= 1.11

If you are using PGFPLOTS version 1.11 or newer, axis cs: is not needed.

From the PGFPLOTS manual Version 1.12.1 (2.2.1 New Optional Features):

PGFPLOTS 1.11 changes the axis cs: it is now the default coordinate system. If you write \draw (1,2) -- (2,2); PGFPLOTS will automatically treat it as \draw (axis cs:1,2) -- (axis cs:2,2);.

  • I always update my tex installation with Tex Live Utility, and I think I have the version 1.12.1 (I've looked at installed packages, asked info about pgfplots, and the according pdf document was marked with version 1.12.1 revision 2015/05/02. But your answer did the job. (Still makes me wondering why it doesn't work with "my version" of 1.12.1) Aug 15, 2015 at 7:51
  • 1
    @Arne Have you tried \pgfplotsset{compat=newest} or \pgfplotsset{compat=1.12}?
    – sergej
    Aug 15, 2015 at 8:05
  • 1
    In the preamble, there was \pgfplotsset{compat=1.8} I've copied that from and older answer: tex.stackexchange.com/questions/129381/… But now with "newest" it works like a charm. Aug 15, 2015 at 8:14

You must log in to answer this question.

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