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.

the next code

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{plotmarks}

\begin{document}

\begin{tikzpicture} [yscale=2]
\draw [very thin, lightgray] (0,0) grid (4,4);
\draw [cyan] plot [only marks, mark=square*,mark size=2.5pt] coordinates {(1,1) (2,3) (2.5,2)};

\end{tikzpicture}
\end{document}

gives

enter image description here

How to avoid the distorsion of the marks?

share|improve this question
    
I admit that I do not see the distortion in the screenshot... However, it might help if you place scale=2 as option somewhere in your \draw [cyan] plot [...] statement (plot marks are drawn after the path as such; perhaps they reset parts of the transformation matrix) –  Christian Feuersänger Jun 7 '12 at 15:14
2  
You can add mark options={yscale=0.5}. –  percusse Jun 7 '12 at 15:22
    
I made a mistake when I uploaded the file. Jake gave the solution in a comment and I wait for his answer because I think it's interesting to know his method. I try your idea but without success with [yscale=2] first and then yscale=1/2 in the plot options. The shape is fine but the coordinates are wrong. –  Alain Matthes Jun 7 '12 at 15:30
2  
@percusse Fine idea, I try yscale=.5 in the options of plot but I forgot mark options={yscale=0.5}. I prefer Jake's method but your idea is interesting. Perhaps you can transform your comment in an answer. –  Alain Matthes Jun 7 '12 at 15:35
    
Thanks, but Jake has nailed it. No need for an additional hack :). –  percusse Jun 7 '12 at 15:44

1 Answer 1

up vote 6 down vote accepted

Here's a style scale plot marks that, if set to false, will patch the \pgfuseplotmark command to reset all transformations that don't influence the position (including scaling). The change is kept local.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{plotmarks}

\makeatletter
\tikzset{
    scale plot marks/.is choice,
    scale plot marks/false/.code={
        \def\pgfuseplotmark##1{\pgftransformresetnontranslations\csname pgf@plot@mark@##1\endcsname}
    },
    scale plot marks/true/.style={},
    scale plot marks/.default=true
}
\makeatother

\begin{document}

\begin{tikzpicture} [yscale=2]
\node [align=center, anchor=north] at (2,4) {\verb|scale plot marks=true|\\(default)};
\draw [very thin, lightgray] (0,0) grid (4,4);
\draw [cyan] plot [only marks, mark=square*,mark size=2.5pt] coordinates {(1,1) (2,3) (2.5,2)};
\end{tikzpicture}
\begin{tikzpicture} [yscale=2]
\node [align=center, anchor=north] at (2,4) {\verb|scale plot marks=false|};
\draw [very thin, lightgray] (0,0) grid (4,4);
\draw [cyan] plot [only marks, mark=square*,mark size=2.5pt,scale plot marks=false] coordinates {(1,1) (2,3) (2.5,2)};
\end{tikzpicture}
\end{document}
share|improve this answer
    
Yes, like this, it's a pleasure to use your method! –  Alain Matthes Jun 7 '12 at 15:37

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.