I have the following .csv
file, percentages.csv
:
prefetcher,trace,ipc,ipc-per-diff
gcc,ampm-lite,0.339157,0.164172
gcc,ghb-pc-dc,0.306047,0.050520
gcc,ip-stride,0.308053,0.057406
gcc,next-line,0.284244,-0.024320
gcc,stream,0.276043,-0.052470
GemsFDTD,ampm-lite,3.451324,0.001837
GemsFDTD,ghb-pc-dc,3.447773,0.000806
GemsFDTD,ip-stride,3.448985,0.001158
GemsFDTD,next-line,3.425332,-0.005708
GemsFDTD,stream,3.437907,-0.002057
lbm,ampm-lite,2.035,0.924161
lbm,ghb-pc-dc,1.374755,0.299877
lbm,ip-stride,1.529501,0.446194
lbm,next-line,1.600095,0.512943
lbm,stream,1.259173,0.190590
leslie3d,ampm-lite,1.623532,0.647876
leslie3d,ghb-pc-dc,1.295898,0.315329
leslie3d,ip-stride,1.407264,0.428365
leslie3d,next-line,1.448414,0.470132
leslie3d,stream,1.033456,0.048952
libquantum,ampm-lite,3.274124,0.040013
libquantum,ghb-pc-dc,3.276536,0.040779
libquantum,ip-stride,3.242776,0.030055
libquantum,next-line,3.293444,0.046150
libquantum,stream,3.172061,0.007593
mcf,ampm-lite,0.372714,0.082426
mcf,ghb-pc-dc,0.349371,0.014634
mcf,ip-stride,0.353506,0.026643
mcf,next-line,0.35061,0.018232
mcf,stream,0.342385,-0.005654
milc,ampm-lite,1.179511,0.202991
milc,ghb-pc-dc,1.117595,0.139842
milc,ip-stride,1.136986,0.159619
milc,next-line,1.212129,0.236258
milc,stream,1.068124,0.089387
omnetpp,ampm-lite,2.269448,0.035387
omnetpp,ghb-pc-dc,2.100247,-0.041807
omnetpp,ip-stride,2.220496,0.013054
omnetpp,next-line,1.85322,-0.154508
omnetpp,stream,2.214889,0.010496
I would like the first column, prefetcher
to be the groups, the second column trace
to be individual vertical bars within each group (and show up as a legend), and the fourth column, ipc-per-diff
to be the height (positive or negative) of each bar.
Ideally, I'd also like to get the x-axis in the middle of the chart, but keep the axis labels at the bottom.
My first attempt:
\begin{tikzpicture}
\pgfplotstableread[col sep=comma,]{../percentages.csv}\datatable
\begin{axis}[
ybar,
symbolic x coords={gcc,GemsFDTD,lbm,leslie3d,libquantum,mcf,milc,omnetpp},
enlarge x limits=0.2,
bar width=0.2cm,
legend style={draw=none,column sep=0.5cm},
legend cell align=right,
]
\foreach \i in {AMPM-Lite,GHB PC/DC,IP Stride,Next Line, Stream} {
\addplot+ [] table [
col sep=comma,
x=prefetcher,
y=ipc-per-diff,
]{../percentages.csv};
\addlegendentryexpanded{\i}
}
\end{axis}
\end{tikzpicture}
Clearly not ideal because it appears the bars are stacked on top of each other, and needless to say, the chart is far too cramped. How can I fix this? Or can I reframe my .csv
data file to more easily plot this?