0

I am trying to draw multiple plots with groupplot and am getting the errors below.

Package pgfkeys Error: I do not know the key '/pgfplots/horizontal sep', to which you passed '20pt', and I am going to ignore it. Perhaps you misspelled it. ]
Package pgfkeys Error: I do not know the key '/pgfplots/vertical sep', to which you passed '20pt', and I am going to ignore it. Perhaps you misspelled it. ]
Package pgfkeys Error: I do not know the key '/pgfplots/x unit', to which you passed '\si {\byte }', and I am going to ignore it. Perhaps you misspelled it. ]
Package pgfkeys Error: I do not know the key '/pgfplots/y unit', to which yout. ]

The offending code:

\documentclass{standalone}
\usepackage[x11names,table]{xcolor}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepgfplotslibrary{groupplots}
\usepackage[binary-units = true]{siunitx}

\begin{document} \begin{tikzpicture} \begin{groupplot} [ group style={group size=2 by 1}, horizontal sep=20pt, vertical sep=20pt, width=0.5\columnwidth, every x tick scale label/.style={at={(rel axis cs:1,0)},yshift=-1.5em,anchor=north east,inner sep=1pt}, every y tick scale label/.style={at={(rel axis cs:0,1)},xshift=-1.75em,anchor=south east,inner sep=1pt}, xmin = 0, ymin = 0, grid=major, grid style={dashed,gray!30}, xlabel=X Axis $\mathcal{N}$, ylabel=Y Axis $Time$, x unit=\si{\byte}, y unit=\si{\second}, legend cell align={left}, legend style={at={(0.5,-0.4)},anchor=north} ]

        \nextgroupplot
        \addplot[color=teal,only marks]
        table[x=Message Length,y=Insertion Time,col sep=comma,scatter] {data.csv};
        \addlegendentry{Insertion}
        \addplot [mark=none,color=Aquamarine2]
        table[x=Message Length,y={create col/linear regression={y=Insertion Time}},col sep=comma] {data.csv};
        \addlegendentry{Insertion Regression Line}

        \nextgroupplot
        \addplot[mark=none,color=Cyan4,thick]
        table[x=Message Length,y={create col/linear regression={y=Extraction Time}},col sep=comma] {data.csv};
        \addlegendentry{Extraction Regression Line}
\end{groupplot}
\end{tikzpicture}

\end{document}

Output: enter image description here

I am in pursuit to prevent the ylabel from overlapping for the plot for which I have resorted to using horizontal sep=5cm as provided here and in the documentation. The error is what I assume is preventing the solution from working as intended. Any guidance is appretiated.

Sample from data.csv:

Message Length,Insertion Time,Extraction Time
1000000,2882.6947407000002,2891.3703151000004
2000000,5969.4817235,5931.724818600001
3000000,8480.4446118,8307.060654199999
4000000,11374.857455500001,10956.432963199999
5000000,13943.201667899999,13806.727052399998
6000000,16637.710391300003,16383.8475286
7000000,19527.7743606,19134.5409173
8000000,22427.304584700003,21726.507952400003
Stefan Pinnow
  • 29,535
Rashiq
  • 337

1 Answers1

4

You did only two minor mistakes which lead to the error messages. Have a look at the comments in the code how to fix them. I also gave two hints how to prevent "the overlapping".

(Please note that I have heavily simplified your code to show only relevant stuff.)

% used PGFPlots v1.18.1
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
    \usepgfplotslibrary{
        groupplots,
        % missed to load the library to make `x unit` and friend work
        units,
    }
    % (add this to `compat` level or higher to make use of the advanced positioning
    % of the axis labels)
    \pgfplotsset{compat=1.3}
\usepackage[binary-units=true]{siunitx}
\begin{document}
\begin{tikzpicture}
    \begin{groupplot}[
        group style={
            group size=2 by 1,
            % moved the next two to this style
            horizontal sep=40pt,    % (<-- increased value to prevent overlapping)
            vertical sep=20pt,
        },
        x unit=\si{\byte},
        y unit=\si{\second},
    ]
\nextgroupplot
    \addplot {x};

\nextgroupplot
    \addplot {x^2};
\end{groupplot}

\end{tikzpicture} \end{document}

image showing the result of above code

Stefan Pinnow
  • 29,535