TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
    
Hi Ahmad. Note that you don't have to sign with your name since it automatically appears in the lower right corner of your post. – Claudio Fiandrino Jan 3 '13 at 8:03
    
I think you can have a look to section 4.4.5 Histograms in the manual of pgfplots. – Claudio Fiandrino Jan 3 '13 at 8:06
    
How about having non-uniform interval? – Ahmad Jan 3 '13 at 8:17
    
I have updated the image in the question to a new link (flickr.com/photos/68902462@N08/8340520199/in/photostream). I would appreciate it if you could upload the modified image. – Ahmad Jan 3 '13 at 8:22
up vote 7 down vote accepted

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

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.