Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Consider the following code:

\documentclass{article}
\usepackage{tikz}


\begin{document}
\begin{tikzpicture}[scale=2]
    \draw[help lines] (-3,-3) grid (3,3);
    \draw (-3,0)--(3,0) node[right] {$x$};
    \draw (0,-3)--(0,3) node[above] {$y$};
    \filldraw (0,1) circle (2pt);
\end{tikzpicture}


\end{document}

The line \filldraw (0,1) circle (2pt); is my focus. I'm scaling the image so I want the position (0,1) to be scaled, but I don't want the radius (2pt) to be scaled. I want the radius to stay (2pt) as the image is scaled (scale=2).

Any ideas?

Thanks.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

It looks to me as if you want to scale only the coordinate system but not the graphic itself. For this, I recommend setting the x and y vectors to 2cm.

This means that a coordinate (2,3) will be interpreted as the coordinate (2*2cm, 3*2cm) = (4cm, 6cm), while, with the default x and y options, scale=2 will do (2*2*1cm, 3*2*1cm).

As the initial setting for the step of a grid is 1cm we also need to change this to 1 so that it is recognized in the TikZ’ coordinate system (and not the canvas as with all values with dimensions).


Another option would be to locally reset any transformation and only scale the coordinate but you will need to repeat any given transformations again:

\filldraw[reset cm] ([scale=2] 0,1) circle (2pt);

There is also the possibility to use a node here:

\node[inner sep=+0pt, minimum size=+1pt, draw, fill, shape=circle] at (0,1) {};

when transform shape is false.

Code

\documentclass[tikz,convert=false]{standalone}
\begin{document}
\begin{tikzpicture}[x=2cm, y=2cm, step=1]
    \draw[help lines] (-3,-3) grid (3,3);
    \draw (-3,0)--(3,0) node[right] {$x$};
    \draw (0,-3)--(0,3) node[above] {$y$};
    \filldraw (0,1) circle (2pt);
\end{tikzpicture}
\end{document}

Output

enter image description here

share|improve this answer
    
Thank you for your ideas. They worked and they helped me learn a lot. –  David Aug 11 '13 at 17:51
1  
@David You’re welcome. If you use the solution of my answer or if it helped you otherwise, you might accept the answer. I also noticed that you don’t have one single accepted answer on your question. It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. –  Qrrbrbirlbel Aug 11 '13 at 18:17
    
That means click the checkmark? –  David Aug 11 '13 at 19:27
    
@David Exactly. :) –  Qrrbrbirlbel Aug 11 '13 at 19:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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