5

I am trying to create a graph with TikZ similar to this image (link: http://www.flickr.com/photos/68902462@N08/8340520199/in/photostream)

enter image description here

It is a histogram whose axes are in logarithmic scale. I would like to have the numbers in exponential format. Could someone help me how to do it? My data for histogram is as follows:

(-INFINITY)-(1e-8): count=0
(1e-8)-(1e-7):      count=27133
(1e-7)-(1e-6):      count=17
(1e-6)-(1e-5):      count=95
(1e-5)-(1e-4):      count=224
(1e-4)-(1e-3):      count=1060
(1e-3)-(1e-2):      count=6900
(1e-2)-(1e+1):      count=34402
(1e+1)-(1e+2):      count=149564
(1e+2)-(1e+3):      count=877
(1e+3)-(+INFINITY): count=0

I would be grateful for any help.

7

PGFPlots can handle non-uniform intervals and log-log histograms:

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
    axis on top,
    width=12cm,
    height=4cm,
    xmode=log,
    ymode=log,
    ybar interval,
    x tick label as interval=false,
    xtick={},
    xtickten={-8,-6,...,4},
    grid=none
]
\addplot [fill=gray!50] table [x=Lower, y=Count] {
Lower Upper Count
0 1e-8 0
1e-8 1e-7 27133
1e-7 1e-6 17
1e-6 1e-5 95
1e-5 1e-4 224
1e-4 1e-3 1060
1e-3 1e-2 6900
1e-2 1e+1 34402
1e+1 1e+2 149564
1e+2 1e+3 877
1e+3 +INFINITY 0
};
\end{axis}
\end{tikzpicture}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.