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 used this:

plot 'dat' u 2:xtic(1) t 'pca-10', \
     'dat' u 3 t 'pca-20', \
     'dat' u 4 t 'pca-30', \
     'dat' u 4 t 'pca-30'

my data is:

antlr   0.9424  0.9363  0.7754  0.7506
bloat   0.9623  0.9357  0.8704  0.7807
eclipse 0.7874  0.7958  0.3617  0.3903
 fop    0.8866  0.8720  0.6590  0.6146
luindex 0.9028  0.9031  0.5168  0.5847
average 0.8950  0.8926  0.6185  0.6332

The last row is the average. How can I add additional space just before the average group of bars, so that it would be more visible?

share|improve this question

1 Answer 1

I'm not sure how to do that with gnuplot, but here's a way to do it with PGFPlots directly within TeX. You can offset the last set of bars using a coordinate filter that conditionally adds some space to the fifth set of coordinates:

\documentclass{article}
\usepackage{filecontents}
\usepackage{pgfplots}

\begin{filecontents}{data.dat}
name    a   b   c   D
antlr   0.9424  0.9363  0.7754  0.7506
bloat   0.9623  0.9357  0.8704  0.7807
eclipse 0.7874  0.7958  0.3617  0.3903
 fop    0.8866  0.8720  0.6590  0.6146
luindex 0.9028  0.9031  0.5168  0.5847
average 0.8950  0.8926  0.6185  0.6332
\end{filecontents}


\begin{document}

\begin{tikzpicture} 
\begin{axis}[
    ybar,
    ymin=0,
    bar width=0.2cm,
    enlarge x limits=0.15,
    width=12cm, height=5cm,
    x filter/.code={\pgfmathparse{#1+(#1==5)*0.5}},
    xtick=data,
    xticklabels from table={data.dat}{name},
    xticklabel style={text height=2ex}
]

\addplot table [x expr=\coordindex] {data.dat};
\addplot table [x expr=\coordindex, y index=2] {data.dat};
\addplot table [x expr=\coordindex, y index=3] {data.dat};
\addplot table [x expr=\coordindex, y index=4] {data.dat};

\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.