# How do I generate a logarithmic x-axis without a y-axis?

I would like to plot the following image using TikZ:

How do I generate an X-axis with logarithmic scaling using TikZ? For linear scaling I use this code:

\usetikzlibrary{plotmarks}
%axis
\draw (3,0) -- coordinate (x axis mid) (21,0);

%ticks
\foreach \x in {3,...,21}
\draw (\x,0pt) -- (\x,-3pt)
node[anchor=north] {\x};

%labels
\node[below=0.8cm] at (x axis mid) {Physical dose [Gy]};

• Maybe it could be faster to use pgfplots Feb 18, 2013 at 9:14
• Yes, but I don't know how to remove the y-axis in pgfplots. Feb 18, 2013 at 9:14

This looks like a job for PGFPlots:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
y=1.5cm,            % y unit vector
hide y axis,        % hide the y axis
xmode = log,        % logarithmic x axis
axis x line*=bottom,% only show the bottom x axis line, without an arrow tip
xmin=1e-4, xmax=1e2,% range for the x axis
xlabel = Dose in Sv
]
\addplot [no markers, line width=6pt] table {
0.002 1
0.004 1
};
\end{axis}
\end{tikzpicture}

\end{document}

• You may also skip the repeaded 1's and use an y expr=1 insted. Dec 18, 2016 at 20:27

It is not supposed to be the correct way to go. Feel free to edit!

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}
\def\f[#1,#2]{!#1 log 4 add #2 8 div}
\begin{document}
\pspicture(0,-0.25)(6,0.125)
\psaxes
[
yAxis=false,
subticks=9,
xlogBase=10,
Ox=-4,
logLines=x,
ticksize=-1.5pt 1.5pt,
](6,0.125)
\psline[linewidth=2\pslinewidth](\f[0.002,1])(\f[0.004,1])
\endpspicture
\end{document}