2

I have a drawing based on 1cm unit.

1cm unit

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs,positioning}
\begin{document}
\begin{tikzpicture}[
  every node/.style = {
    circle,
    very thick,
    inner sep = 0,
    outer sep = 0,
    minimum size = 1cm,
    draw = black,
    scale = 1,
  },
]
\graph[grow right sep = 1cm]{
  1 -> 2 -> 3 -> 4
};
\draw[help lines] (-0.5, -1.5) grid (8, 1.5);
\end{tikzpicture}
\end{document}

I'd like to scale it to 0.75× while preserving the font size (which should stay the same as the rest of the document). I did manage to get the desired output, but I think it's rather hacky because I don't know why it's working.

0.75cm

% …
\begin{tikzpicture}[scale=0.75,
% …
    minimum size = 0.75cm,
% …
\graph[grow right sep = 5mm]{
% …

What is bugging me particularly is grow right sep = 5mm, which I got right by trial and error.

1 Answer 1

3

Scaling had to be done also for nodes shapes (by transform shapes):

\documentclass[border=3.141502, varwidth]{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs,positioning}
\begin{document}
    \begin{tikzpicture}[scale=0.75, transform shape,%x=7.5mm,
every node/.style = {circle, draw, very thick,
                     inner sep = 0, outer sep=0pt,
                     minimum size = 10mm},
                        ]
\graph[grow right sep=10mm]{
  1 -> 2 -> 3 -> 4
};
\draw[help lines] (-0.5,-1.5) grid (8,1.5);
    \end{tikzpicture}

\medskip   
    \begin{tikzpicture}[
every node/.style = {circle, draw, very thick,
                     inner sep = 0, outer sep=0pt,
                     minimum size = 10mm},
                        ]
\graph[grow right sep=10mm]{
  1 -> 2 -> 3 -> 4
};
\draw[help lines] (-0.5,-1.5) grid (8,1.5);
    \end{tikzpicture}
\end{document}

enter image description here

Addendum: Unfortunately the question wasn't entirely clear (at least me). Now I guess, that you like to have smaller shapes, smaller node distances but normal text font size. This can be achieved by accordingly changes size of nodes, size of node distance and (if you like) also step of help lines. all this changes are in code marked by % <---:

\documentclass[border=3.141502, varwidth]{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs,positioning}
\begin{document}
    \begin{tikzpicture}[
every node/.style = {circle, draw, very thick,
                     inner sep = 0, outer sep=0pt,
                     minimum size = 7.5mm}, % <---
                        ]
\graph[grow right sep=7.5mm]{               % <---
  1 -> 2 -> 3 -> 4
};
\draw[help lines, step=7.5mm]               % <---
    (-0.5,-1.5) grid (6,1.5);
    \end{tikzpicture}

for comparison with "scaled" image: 
 
    \begin{tikzpicture}[
every node/.style = {circle, draw, very thick,
                     inner sep = 0, outer sep=0pt,
                     minimum size = 10mm},
                        ]
\graph[grow right sep=10mm]{
  1 -> 2 -> 3 -> 4
};
\draw[help lines] (-0.5,-1.5) grid (8,1.5);
% for test of scaling:
    \end{tikzpicture}
\end{document}

enter image description here

Is this result what you after? As you see, it cannot be get by simple scaling. However you still can use first solution and in nodes use bigger font size, for example Large in your case.

5
  • I don't want the text to be scaled, though. Also, do you understand why right sep needs to be set to 5mm rather than 7.5mm in my solution?
    – Atcold
    Feb 11 at 16:38
  • @Atcold, see addendum to my answer.
    – Zarko
    Feb 11 at 18:29
  • I see. You've specified new sizes for everything. I hoped everything could have been scaled with a single command. I want to draw things within the new scaled reference system, say a rectangle enclosing some nodes without resorting to using multiples of 7.5 cm.
    – Atcold
    Feb 11 at 19:21
  • @Atcold, named coordinates and shape cannot be scaled. Anyway, scaling id not magic wand, so avoid it as much as it is possible.
    – Zarko
    Feb 12 at 13:35
  • Thank you for your time and explanations.
    – Atcold
    Feb 13 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.