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.

I would like to plot the following image using TikZ:

enter image description here

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]};
share|improve this question
    
Maybe it could be faster to use pgfplots –  Lionel MANSUY Feb 18 '13 at 9:14
    
Yes, but I don't know how to remove the y-axis in pgfplots. –  biologue Feb 18 '13 at 9:14
add comment

2 Answers 2

up vote 15 down vote accepted

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}
share|improve this answer
add comment

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

enter image description here

\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}
share|improve this answer
add comment

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.