2

i want the values in each bar. What can I that it works? I want the values in the middle of the bars and change the size. An other idea was to change the zoom for the y values from 0 to 300. How could I do this?

Another problem is that I want other values. At the moment I have this values for the first bar (428.58, 450, 492.09). This is the sum of my data. But I want only the values of the table like (428.58, 21.43, 42.08).

Thanks for your time and invaluable help guys!

\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.9, }

\pgfplotstableread{ % data 
    Label n a b
    450.01 428.58 21.43 42.08
    500 471.31 28.69 46.75
    550 514.06 35.94 51.43
    600 556.80 43.20 56.10
    650 599.55 50.45 60.78
    700 642.29 57.71 65.45
    750 685.04 64.96 70.13
    800 727.78 72.22 74.80
    850 770.52 79.48 79.48
}\testdata


\begin{tikzpicture}[scale=0.70]
        \begin{axis}[
            width=\textwidth,
            ybar stacked,   % Stacked horizontal bars
            ymin=0,         % Start x axis at 0
            xtick=data,     % Use as many tick labels as y coordinates
            xticklabels from table={\testdata}{Label},  % Get the labels from the Label column of the \datatable
            grid=major,
            xmajorgrids=false,
            nodes near coords,
        ]
        %[mark=none,smooth, thick]
        \addplot [fill=green!80, bar width=0.6cm] table [y=n, meta=Label,x expr=\coordindex] {\testdata};   
        \addplot [fill=blue!60, bar width=0.6cm] table [y=a, meta=Label,x expr=\coordindex] {\testdata};
        \addplot [fill=red!60, bar width=0.6cm] table [y=b, meta=Label,x expr=\coordindex] {\testdata};
        \end{axis}
\end{tikzpicture}

enter image description here

ikreb
  • 491

0 Answers0