# How to make the plot mark size independent of the scale?

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

How to avoid the distorsion of the marks?

-
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
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
@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

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}

-
Yes, like this, it's a pleasure to use your method! –  Alain Matthes Jun 7 '12 at 15:37