LaTeX forum ⇒ Graphics, Figures & TablestikZ | Scale Picture

Information and discussion about graphics, figures & tables in LaTeX documents.
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

tikZ | Scale Picture

Postby Singularity » Mon Sep 05, 2011 10:43 pm

How do I scale this tikz graphic I once made? I tried using
\begin{tikzpicture}[scale=1.5]

but that created spaces and didn't move the text. Thank you.

\begin{tikzpicture}   
	% Left wall
	\draw[very thick] (0,-.5) -- (0,.5);

	% First spring (s_0)
	\draw (0,0) -- (0+.25,0);
	\draw (0+.375,-.0125) ellipse (1.25mm and 1.25mm)
				(0+.500,-.0125) node [above,outer sep=2pt,name=s0] {$s_{_0}$} ellipse (1.25mm and 1.25mm)
        (0+.625,-.0125) ellipse (1.25mm and 1.25mm);
	\draw (0+.75,0) -- (0+1,0);
  
	% First two masses and two springs (m_1, s_1, m_2, s_2)
	\foreach \x in {1,2} {
		% Mass (it's just a rectangle)
		\draw ((1.75*\x-.75,0) node[draw,rectangle,name=m\x,anchor=west] {$m_{_\x}$};
		
		% Spring (three circles with connecting lines on the ends).
		\draw (1.75*\x,0) -- (1.75*\x+.25,0);
		\draw (1.75*\x+.375,-.0125) ellipse (1.25mm and 1.25mm)
					(1.75*\x+.500,-.0125) node [above,outer sep=2pt,name=s\x] {$s_{_\x}$} ellipse (1.25mm and 1.25mm)
					(1.75*\x+.625,-.0125) ellipse (1.25mm and 1.25mm);
		\draw (1.75*\x+.75,0) -- (1.75*\x+1,0);
	}
   
   % Ellipses
   \foreach \i in {0,...,2} {
      \path (4.65+\i*.1,0) coordinate (X\i);
      \fill (X\i) circle (1pt);
   }

	% First post-ellipses spring (s_{N-1})
	\draw (5,0) -- (5.25,0);
	\draw (5.375,-.0125) ellipse (1.25mm and 1.25mm)
           (5.500,-.0125) node [above,outer sep=2pt,name=sN-1] {$s_{_{N-1}}$} ellipse (1.25mm and 1.25mm)
           (5.625,-.0125) ellipse (1.25mm and 1.25mm);
	\draw (5.75,0) -- (6,0);
  
	% Last mass and spring (m_N, s_N).
	\foreach \x in {1} {
		% Mass (it's just a rectangle)
		\draw (6,0) node[draw,rectangle,name=mn,anchor=west] {$m_{_N}$};

		% Spring (three circles with connecting lines on the ends).
		\draw (6.8,0) -- (6.8+.25,0);
		\draw (6.8+.375,-.0125) ellipse (1.25mm and 1.25mm)
					(6.8+.500,-.0125) node [above,outer sep=2pt,name=sn] {$s_{_N}$} ellipse (1.25mm and 1.25mm)
					(6.8+.625,-.0125) ellipse (1.25mm and 1.25mm);
		\draw (6.8+.75,0) -- (6.8+1,0);
	}
	\draw[very thick] (7.8,-.5) -- (7.8,.5);

   % The original spring and mass.
%   \draw (0,0)  -- (.25,0);
%   \draw (.375,-.0125) ellipse (1.25mm and 1.25mm)
%            (.500,-.0125) node [above,outer sep=2pt,name=s0] {$s_0$} ellipse (1.25mm and 1.25mm)
%            (.625,-.0125) ellipse (1.25mm and 1.25mm);
%               
%   \draw (.75,0) -- (1,0);
%%   \draw (1,-.25) rectangle (2,.25) (1.5,0) node [name=m0] {$m_0$};
%   \draw (1,0) node[draw,rectangle,name=m0,anchor=west] {$m_0$};
\end{tikzpicture}
Last edited by Singularity on Tue Sep 06, 2011 1:33 pm, edited 1 time in total.

User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Postby shadgrind » Tue Sep 06, 2011 10:22 am

Use the graphicx package and put your tikzpicture environment inside a \scalebox command:

\documentclass{article}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}

\scalebox{1.5}{\begin{tikzpicture}
 % Put your tikz code here
\end{tikzpicture}}

\end{document}
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2

Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Postby Singularity » Tue Sep 06, 2011 1:33 pm

Worked first time.
Thanks.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 9 guests