1

How can I overcome the issue I'm having with the chart below:

Stacked Bar Chart

\begin{figure}[h!]
\centering
\caption{\label{tab:kdd99chartProt}Attack representation per protocol within     KDD99 10\% dataset} 
\begin{tikzpicture}
\begin{axis}[
ybar stacked, ymin=0,  
bar shift=0pt,
ymajorgrids,
bar width=30pt,
ylabel=Representation in \%,
width=250pt,
symbolic x coords={TCP,UDP,ICMP},
legend pos=outer north east,
xtick=data,
ymax=85,
nodes near coords={\pgfmathprintnumber\pgfplotspointmeta \%}
]

\addplot [black,fill=bblue,mark=none] coordinates {
({TCP},23)
({UDP},0.2)
({ICMP},57)};

\addplot [black,fill=rred,mark=none] coordinates {
({TCP},16)
({UDP},4)
({ICMP},0.2)};
\legend{Attack,Normal}
\end{axis}
\end{tikzpicture}
\end{figure}
  • Hi, welcome! How did you produce that chart? We can't possibly help you fix your code if we don't know what you did. – Torbjørn T. Dec 7 '16 at 12:53
  • @TorbjørnT. I've added the code. Thank you! – user2459813 Dec 7 '16 at 12:57
  • @user2459813 Well, that's going to be a tough one. You are comparing 0.2% with 57%, and also 4% with 0.2% in a 0-80% scale. No wonder the numbers will overlap. As far as I can see you either tweak with nodes near coords style and make the font smaller, put the nodes to the left and give them some shifting or place the nodes manually. I think the second option is the best one (you don't have many data points). – Guilherme Zanotelli Dec 7 '16 at 15:24
  • Could you perhaps guide me on how to place the nodes manually? – user2459813 Dec 8 '16 at 7:08
  • 1