Some confusions relating to device's lengths in Tikz or CircuitTikz

Sorry that this is a very basic question here but couldn't find it anywhere. Hope you could explain or give me a link.

\documentclass[border={5mm 5mm 5mm 5mm}]{standalone}
\usepackage[american,siunitx]{circuitikz}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{backgrounds}

\begin{document}

\begin{tikzpicture}
\draw (0,3) to[R, l=$R_1$] ++(3,0) node[npn, anchor=B]{};
\end{tikzpicture}

\end{document}


First, this one would create a nice circuit with a resistor and transistor. As I understand, it starts at point (0,3) and the place a resistor and then at point (3,3) it will place a transistor there.

So far so good. Now if I change it to something like this.

\draw (0,3) to[R, l=$R_1$] ++(1,0) node[npn, anchor=B]{};


So with the same logic above, I supposed that the transistor is placed at point (1,3) but the figure become some weird thing.

I think it is because I make the distance between them too small, smaller than the componenent length.

However, is there source where they define the length of resistor, transistors, etc? For example, if you just draw a resistor only (I don't know how as well), would it draw it like below? If so what would be the length of these marked parts in the image?

In the manual, page 33, you can find this:

which is indeed a bit hidden and cryptic. The size of components does not depend on the path where they are positioned; they have their own size, are placed in the middle of the path, and then connected. So in your diagram, the distance y is determined by the component, and it's a fixed percentage of bipoles/length, and x depends on the external path.

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{tikzpicture}[]
\draw[cyan!30] (0,0) grid[step=1mm] (5,5);
\draw[thick, cyan!30] (0,0) grid[step=1cm] (5,5);
\node [resistorshape] at (2,4){};
\draw (1,3) to[R] (3,3);
\draw (0,2) to[R] (4,2);
% just an example: changing bipoles/length should be *global*
% at least for the current picture.
\ctikzset{bipoles/length=1cm} % don't do that, use styles!
\draw[red] (1,1) to[R] (3,1);
\end{tikzpicture}
\end{document}


More in detail, for the resistor, the length of the core component is 0.8 times the basic length; you can find the information in the "list of components" part of the manual:

For node-style components, like the transistor, it's more or less the same.

I advise you to read the chapter about "styling" if you want to change the relative sizes of components:

• Thanks, what would be the length between two points in each direction? For example, would it be 1cm between (0,0) and (1,0)? Commented Dec 9, 2022 at 11:06
• By default, TikZ sets x=1cm, y=1cm, so yes --- but you can change it. Commented Dec 9, 2022 at 11:09
• Nice grid and addition of resistors/width. I was counting the number of small squares and wondered why not 1.4cm. Commented Dec 9, 2022 at 11:21
• ;-) the grid trick is very useful when drawing circuits, although if one learns to use named coordinates and relative movements is less valuable. Commented Dec 9, 2022 at 11:27