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 am looking for a package to create bullet gauge graphs, but I couldn't find any.

A bullet graph looks like this:

enter image description here

and an ample description/specification can be found here

It is available in Mathematica 9 (see here)

Is it possible create this kind of graphs in a easy way with TeX (like Matehmatica 9 or similar)?

share|improve this question
1  
in general: tikz is great –  Micha Jun 2 '13 at 18:03
    
Are you sure they are called ´bullet diagrams´? I'm not questioning your english, but rather the way to look for a package at CTAN(ctan.org) –  Mario S. E. Jun 2 '13 at 18:22
    
@MarioS.E., Yes, i´m suer, because the creator of this kind of graphs is Stephen Few, and the specifications (by the author) are: perceptualedge.com/articles/misc/Bullet_Graph_Design_Spec.pdf –  Mika Ike Jun 2 '13 at 19:11
    
@MikaIke to my knowledge there is no direct package in CTAN for dealing with bullet diagrams... but as mentioned as @Micha, the Tikz is very versatile and you should be able to replicate what you want. I think the samples you showed were made with Excel. You can always use them as figures in your LaTeX file –  Mario S. E. Jun 2 '13 at 19:22

1 Answer 1

up vote 21 down vote accepted

This can be relatively easily achieved using PGFPlots. I've written a small macro that is called like this:

\bulletgauge[title={\bfseries{\large Revenue}\\1000 USD}]{275}{260}{300,250,150}

to create this:

The optional argument can be used to pass normal PGFPlots options to the axis environment used internally.

\documentclass[border=5mm]{standalone}
\usepackage{pgfplots, pgfplotstable}

\definecolor{ylgnbu1}{RGB}{237, 248, 177}
\definecolor{ylgnbu2}{RGB}{127, 205, 187}
\definecolor{ylgnbu3}{RGB}{44, 127, 184}

\pgfplotscreateplotcyclelist{bullet}{
{fill=ylgnbu1, draw=none},
{fill=ylgnbu2, draw=none},
{fill=ylgnbu3, draw=none},
}

\pgfplotstableread[col sep=semicolon]{
Label;  Sublabel;   Measure;    CompMeasure; Range1; Range2; Range3
Revenue 2005 YTD;   USD;    260;    255;150;250;300
}\datatable

\newcommand{\bulletgauge}[4][]{
    \begin{tikzpicture}
    \begin{axis}[
        y=1.5ex,
        xtick pos=left,
        ytick=\empty,
        xmin=0, xmax=300,
        enlarge y limits={abs=0ex},
        tick align=outside,
        axis on top,
        every axis title/.style={
            at={(rel axis cs:0,0.5)},
            anchor=east,
            align=right,
            xshift=-1em
        },
        #1
    ]
    \pgfplotsinvokeforeach{#4}{
        \pgfplotsset{cycle list name=bullet}
        \addplot +[xbar, bar width=3ex] coordinates {(##1,0)};
    }
    \addplot [fill=black, xbar, bar width=1ex] coordinates {(#2,0)};    
    \addplot [mark=|, mark options={very thick}, mark size=1.25ex] coordinates {(#3,0)};
    \end{axis}
    \end{tikzpicture}
}


\begin{document}
\bulletgauge[title={\bfseries{\large Revenue}\\1000 USD}]{275}{260}{300,250,150}
\end{document}
share|improve this answer
    
Jake. I admire your work. I think that comunity need your bullet guage package! :-) For me is enough, but i like your creation. –  Mika Ike Jun 3 '13 at 13:15
    
Really Fantastic. Yes :-)) You have created the solution. I would anime you to create a special package for this kind of graphs. It´s very usefull and each day it´s more popular and known. You have created the basic (and more dificult) graph, but.... like you are capable, I think that you would make well creating more options, and your own package. Mathematica offer to bullet gauges many features, as you can see: imageshack.us/a/img35/1061/snap2134.png For me it´s enough to see your creation, but ... I think that you can create a new and usefull package. –  Mika Ike Jun 4 '13 at 8:57
    
You have created the solution. I would anime you to create a special package for this kind of graphs. It´s very usefull and each day it´s more popular and known. Mathematica offer many and interesting bullet gauges, if you like to see. I think that it´s good add the possibility of any other bars and/or marks For me it´s enough to see your cretion, but ... I think that you can create a new and usefull package. –  Mika Ike Jun 9 '13 at 18:27

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.