13

In beamer presentation, it shows environment axis undefined, anyone suggest to clear my query

\begin{frame}
    \begin{figure}[hbt]
      \centering
      \begin{tikzpicture}
        \begin{axis}[
            ybar stacked,
            nodes near coords,
            every node near coord/.append style=
    {xshift=-15pt,yshift=-3pt,anchor=east,font=\footnotesize},
            xbar legend,
    %         nodes near coords align={right},
            legend pos=outer north east,
            enlarge x limits={abs=1},
            enlarge y limits=false,
            bar width=35.5,width=10cm,height=11cm,
            % x axis
            xtick={1,2,3},
            xticklabels={p1,p2,p3},
            % y axis
            ymin=0,
            ylabel={Scheduling Length},
            xlabel={Processors},
            %yticklabels={0,10,20,30,40,50,60,70,80,90,500},
          ]
          \addplot table [
            x=index,
            y=blue,
          ] {
    index   blue            pink    gray    orange
    1       40              18      07      00
    2       34              36      19      00
    3       09              17      09      10
          };
          \addplot table [
            x=index,
            y=pink,
          ] {
    index   blue            pink    gray    orange
    1       40              18      07      00
    2       34              36      19      00
    3       09              17      09      10
    };
          \addplot table [
          x=index,
          y=gray,
          ] {
    index   blue            pink    gray    orange
    1       40              18      07      00
    2       34              36      19      00
    3       09              17      09      10
          };
          \addplot table [
            x=index,
            y=orange,
          ] {
    index   blue            pink    gray    orange
    1       40              18      07      00
    2       34              36      19      00
    3       09              17      09      10
          };
          %\legend{First one,Second one,Third,Fourth}
        \end{axis}
      \end{tikzpicture}

    \end{figure}

    \end{frame}
4
  • 13
    Did you load pgfplots in your preamble?
    – Joseph Wright
    Commented Dec 17, 2015 at 20:02
  • @ Joseph Wright, yes but it could not read table file and it suggest try row sep = crcr
    – KBM
    Commented Dec 17, 2015 at 20:13
  • 1
    @Joseph Wright, Error : Package pgfplots Error: Could not read table file '" index blue pink gray orange 1 40 18 07 00 2 34 36 19 00 3 09 17 09 10 "'. In case you intended to provide inline data: maybe TeX screwed up your end-of-lines? Try row sep=crcr' and terminate your lines with `\`
    – KBM
    Commented Dec 17, 2015 at 20:15
  • 1
    Try adding [fragile] to the \begin{frame}? Or try posting a minimal example we can reproduce the error with?
    – cfr
    Commented Dec 18, 2015 at 22:56

0

Browse other questions tagged .