As I understand it, the basic unit length in TikZ is 1cm, so that for example

\draw (0,0) -- (1,0);

draws a line 1cm in length. What I want to do is to redefine that length so that all drawings in my document are a different size. Using ConTeXt, how can I do this?

  • Ummm... discovered it myself soon after posting; it's \tikzset{every picture/.style={scale=1.5}}
    – Alasdair
    Commented Apr 17, 2011 at 10:21

1 Answer 1


You can set the units length in TikZ for X, Y and even Z coordinates independently using the x, y and z keys:


See the pgfmanual p.249 section 22.2 The XY- and XYZ-Coordinate Systems.

Note that TikZ actually doesn't have unit length, but uses vectors. The above keys therefore also accept (a,b) coordinates (which must be enclosed in { } to hide the ,). The X and Y unit vectors do not need to be orthogonal to each other. The above code is the short version of [x={(2cm,0cm)},y={(0cm,1.5cm)}].

You can also use the mentioned option scale as well, but I would prefer the above options. One difference will be that coordinates with explicit units are scaled as well with scale. For example (2cm,2) will be 3cm in both directions when scale=1.5 is set, but (2cm,3cm) with x=1.5cm,y=1.5cm.

One problem with the use of vectors is that you can't access the effective unit length even for the default setup of an XY (no Z) orthogonal coordinate system. I personally needed that for my tikz-timing package. You need to use PGF code for this: \pgfpointxy{1}{1} will give you the X and Y unit length as \pgf@x and \pgf@y. But note that these length registers will be overwritten by the next PGF or TikZ command.

  • 1
    In case you want to make a triangular grid, it turns out that you shouldn't scale the x component of the y vector by the unit length. i.e. [x={(<unit length>,0)},y={(cos(60),<unit length>*sin(60))}] works, but [x={(<unit length>,0)},y={(<unit length>*cos(60),<unit length>*sin(60))}] is skewed. Or at least, in my attempts.
    – repurposer
    Commented Nov 3, 2015 at 17:09

You must log in to answer this question.

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