4

I'm trying to typeset the minimal pgfplots example from the Context Wiki but with no success.

Context-Wiki Example

\setupcolors[state=start]
\usemodule[tikz]
\usemodule[pgfplots]

\starttext

\starttikzpicture
        \startaxis[     xmin=0,xmax=300,
                        title=http://cryogenics.nist.gov/,
                        xlabel=$T$ (K),
                        ylabel=$(L-L_{293})/L_{293}$,
                        legend style={at={(0.95,0.05)},anchor=south east},
                        width=16cm ]
                \addplot[mark=none,color=red] plot file {sapphire.dat};
                \addlegendentry{sapphire}
                \addplot[mark=none,color=green] plot file {Be.dat};
                \addlegendentry{Be}
                \addplot[mark=none,color=blue] plot file {BeCu.dat};
                \addlegendentry{BeCu}
                \addplot[mark=none,color=cyan] plot file {SS304.dat};
                \addlegendentry{SS304}
                \addplot[mark=none,color=magenta] plot file {Al6061-T6.dat};
                \addlegendentry{Al6061-T6}
                \addplot[mark=none,color=orange] plot file {nylon.dat};
                \addlegendentry{nylon}
        \stopaxis
\stoptikzpicture

\stoptext

No matter which setup i use: the vanilla TexLive-2011 or the up-to-date standalone context i get always the same error:

    texmf-modules/tex/generic/pgfplots/numtable/pgfplotstable.coltype.code.tex)
! Missing number, treated as zero.

system          > tex > error on line 1043 in file pgfplottest.tex: Missing number, treated as zero ...


<to be read again> 
                   ^
l.1043 \catcode`\^^
                   I=12

The used versions are as followed:

pgfplots-1.5.1

mtx-context | ConTeXt Process Management 0.52
mtx-context |
mtx-context | main context file: /opt/context-minimals/texmf-context/tex/context/base/context.mkiv
mtx-context | current version: 2012.04.19 23:18

Any Ideas?

  • Seems to work with MKII though. – Torbjørn T. Apr 23 '12 at 20:13
  • Tried that too but had only success with context(pdftex) not working with context(xetex). – Zonk Apr 23 '12 at 20:21
6

This seems to be either a bug on the pgf side or in the ConTeXt pgf module. It's a category code issue while reading the following lines of file pgfplotstable.code.tex.

{
  \catcode`\^^I=12
  \gdef\pgfplotstablesave@impl@TAB{^^I}
}

A work around is to fix the catcodes manually:

% \usemodule [tikz]
% \usemodule [pgfplots]

\unprotect
  \input t-pgfplots
\protect

\starttext

\starttikzpicture
\startaxis
    [xmin=0,xmax=300,
    title=http://cryogenics.nist.gov/,
    xlabel=$T$ (K),
    ylabel=$(L-L_{293})/L_{293}$,
    legend style={at={(0.95,0.05)},anchor=south east},
    width=16cm]
    \addplot[mark=none,color=red] plot file {sapphire.dat};
    \addlegendentry{sapphire}
    \addplot[mark=none,color=green] plot file {Be.dat};
    \addlegendentry{Be}
    \addplot[mark=none,color=blue] plot file {BeCu.dat};
    \addlegendentry{BeCu}
    \addplot[mark=none,color=cyan] plot file {SS304.dat};
    \addlegendentry{SS304}
    \addplot[mark=none,color=magenta] plot file {Al6061-T6.dat};
    \addlegendentry{Al6061-T6}
    \addplot[mark=none,color=orange] plot file {nylon.dat};
    \addlegendentry{nylon}
\stopaxis
\stoptikzpicture

\stoptext

This example works here with 2012.04.19 23:18 and luatex (MkIV).

Note: The catcode issue is fixed now and the workaround is not necessary any more (unless your pgfplots in older than 2012-05-12). The module can be loaded as usual:

\usemodule [pgfplots]
  • This fixes the problem of typesetting but have you took a look at your output? Do you see any curves or the legend? I only see the frame with axis labels no curves nor the legend. – Zonk Apr 23 '12 at 21:42
  • 1
    @Zonk That would be because the data files are not available (check the log file, you'll see messages about this). Replace all the \addplot lines with e.g. \addplot {x}; (and perhaps change the xmax value) to see something happening. – Torbjørn T. Apr 23 '12 at 21:49
  • @Torbjørn T. Aaaah my bad, thanks now it works. – Zonk Apr 23 '12 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.