[Tex/LaTex] How to make a ruler with logarithmic divisions

tikz-pgf

I'm trying to make a slider for a custom cut-out slide ruler with logarithmic increments/divisions on each side. On one side the scale needs to go from 100 to 5000. On the other it needs to go from 0.1 to 10.

I can make a ruler, e.i. like this:

\documentclass[12pt]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[rotate=0,transform shape]
    %% Draws a 15 cm ruler ''box''
        \draw (-0.2,0) rectangle (15.5,1);
        %% Lower side divisions in cm
            % Draws long line every 1 cm
            \foreach \x in {0,1,...,15}{
            \draw (\x,0) -- (\x,0.2)node[above,scale=0.4]{\x};
            }
            % Draws medium line every 0.5 cm
            \foreach \x in {0.1,0.2,...,14.9}{
            \draw (\x,0) -- (\x,0.075);
            }
            % Draws short line every 0.1 cm
            \foreach \x in {0.5,1,...,14.5}{
            \draw (\x,0) -- (\x,0.15);
            }

    %% Upper side divisions in inches
            % Draws long line every 1 in
            \foreach \x in {0,1,...,6}{
            \draw (\x in,1) -- (\x in,0.8)node[below,scale=0.4]{\x};
            }
            % Draws medium line every 0.5 in
            \foreach \x in {0.1,0.2,...,5.9}{
            \draw (\x in,1) -- (\x in,0.925);
            }
            % Draws short line every 0.1 in
            \foreach \x in {0.5,1,...,5.5}{
            \draw (\x in,1) -- (\x in,0.85);
            }
    \end{tikzpicture}
\end{document}

But this have just normal, even increments. I've been looking everywhere to find out how to make them logarithmic, but I've had no luck so far. The closest I've come is axis and pgfplots, but I hav no ide how to utilize that for a slider/ruler like the one over.

Any tips or points in the right direction would be much appreciated!

In advance thanks to anyone who can help.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CLARIFICATION/UPDATE ON QUESTION:

Hi again.

I was not precise earlier.
I want to to make a ruler about similar to this one:
enter image description here

It doesn't need to be exactly like it and internal placement of the scales is for now not important. I just want to know how to make the logarithmic divisions. I have seen the other post seen here: How can I make a slide rule in TikZ?

The solution here is a logarithmic grid system with a hidden axis, producing something like this:Log axis

This gave me a couple of problems:
I haven't figured out how to put custom numbering on this, i.e. (0.1,0.2,0.3,…1,2,3,…10,20,30,…100) instead of 1e0.1,1e0,2, and so on.
The other is to have two og them side by side in a ''ruler'' ment for cut-out.

If \foreach can do this directly it would be perfect. But I haven't been able to find anything about it anywhere.

I hope this made my question a little clearer.

Best Answer

Here a solution for your problem. The values can be adjusted by choosing other calculations in the foreach-loops. This example uses a loop for creating the steps from 1 to 10 by applying a multiplicator (0.1, 1 and 10). This scope gets shifted to fit its position.

To get your orientation right you havee to rotate your tikzpicture (you can also use another scope) and adjust the node's position and rotation.

\documentclass[tikz, border=6mm]{standalone}

\begin{document}
  \begin{tikzpicture}[scale=4, rotate=90]
    \foreach \i\s in {0.1/0,1/1,10/2} {
      \begin{scope}[xshift=\s cm]
        \foreach \x [evaluate=\x as \y using log10(\x), evaluate=\x as \l using \x*\i] in {1,...,10} {
          \draw (\y,0) -- ++(0,.25) node [left, rotate=0] {\tiny \pgfmathprintnumber{\l}};
        }
        \foreach \x [evaluate=\x as \y using log10(\x)] in {1,1.2,...,10} {
          \draw (\y,0) -- ++(0,.1);
        }
      \end{scope}
    }
    \draw (-.1,0) rectangle ++(3.2,.5);
  \end{tikzpicture}
\end{document}

rendered image

Related Question