1

How do I scale the graph on the left, but have the text on the right side still be the same size and at the same position?

\begin{tikzpicture}
[ultra thick, font=\Huge, scale=1]
\draw[ultra thin] (-0,0) grid(3,6);
\draw (0,0)--(2,1)--(3,2)--(3,3)--(2,4)--(0,5)--(-3,6);
\draw (0,0) rectangle (2,1);
\draw (2,1) rectangle(3,2);
\draw (3,3) rectangle (2,4);
\draw (2,4) rectangle(0,5);
\draw (0,5) rectangle (-3,6);
\node [red,above, text width=5cm] at (7,2) {Sample Text \ Sample text};
\end{tikzpicture}
1
  • 2
    Welcome to TeX.SX! For future reference, please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. Commented Aug 30, 2021 at 19:39

1 Answer 1

2

Put the parts you want to scale inside a scope:

\begin{tikzpicture}
[ultra thick, font=\Huge, scale=1]
\draw[ultra thin] (-0,0) grid(3,6);
\begin{scope}[scale=2]
\draw (0,0)--(2,1)--(3,2)--(3,3)--(2,4)--(0,5)--(-3,6);
\draw (0,0) rectangle (2,1);
\draw (2,1) rectangle(3,2);
\draw (3,3) rectangle (2,4);
\draw (2,4) rectangle(0,5);
\draw (0,5) rectangle (-3,6);
\end{scope}
\node [red,above, text width=5cm] at (7,2) {Sample Text \ Sample text};
\end{tikzpicture}

The node text wouldn't scale anyway because nodes don't scale unless you really, really want them to. But with the scale option on the overall picture then its position (7,2) would scale. So in this example, the only part that needs the scope is keeping the node at the exact same position.

(I also left the grid out of the scope, mainly to show that the scale only affects things inside the scope, but also because I wasn't sure how much of the diagram "the graph on the left" referred to.)

You must log in to answer this question.

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