4

I'm using

\documentclass{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
        %axis
    \draw (0,0) -- coordinate (x axis mid) (10,0);
        \draw (0,0) -- coordinate (y axis mid) (0,10);

   \foreach \y in {0,1,...,10}
            \draw (1pt,\y) -- (-3pt,\y) 
                node[anchor=east] {\y}; 


\end{tikzpicture}

\end{document}

to get ticks along y-axis. I want to get ticks label after multiplying be 10 something like this

\foreach \y in {0,1,...,10}
            \draw (1pt,\y) -- (-3pt,\y) 
                node[anchor=east] {\y*10};

I wonder how I can get this. Any help will be highly appreciated. Thanks

MYaseen208
  • 8,587
  • 1
    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. – jub0bs Feb 06 '14 at 18:57
  • @Jubobs: Please my edits. – MYaseen208 Feb 06 '14 at 19:00

1 Answers1

6

You can use \pgfmathsetmacro (or \pgfmathtruncatemacro if you desire only integer values):

enter image description here

Notes:

  • The y=0.5cm option was used to obtain an output that takes up less space here. You do not need to use it in your actual use case.

Code:

\documentclass[border=5mm]{standalone}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[y=0.5cm] \foreach \y in {0,1,...,10} \pgfmathtruncatemacro{\Result}{\y*10}% \draw (1pt,\y) -- (-3pt,\y) node[anchor=east] {\Result}; \end{tikzpicture} \end{document}

Peter Grill
  • 223,288