\documentclass[preview]{standalone}
\usepackage[utf8]{inputenc}


% Page setup
\usepackage{amsmath}

% Typography
\usepackage[scaled]{helvet}
\let\familydefault\sfdefault
\usepackage{sansmath}
\sansmath

\usepackage[usenames,svgnames]{xcolor}
\usepackage{tikz,pgfplots}
\usetikzlibrary{arrows,positioning,shapes,calc,intersections}
\usepgfplotslibrary{colorbrewer}

\newcommand\plotfontsize{\fontsize{9}{9}\selectfont}
\pgfplotsset{compat=1.9,
  axis lines=left,
  every axis/.append style={
    font=\plotfontsize,
  },
  label style={
    font=\plotfontsize\bfseries,
  },
  tick label style={
    font=\plotfontsize\bfseries,
  },
  legend cell align=left,
  legend style={
    /tikz/every even column/.append style={column sep=.3em},
    draw=none, fill=none,
    inner sep=0pt, outer sep=0pt,
    anchor=north east,
    text height=3pt,
  },
  log base 10 number format code/.code={%
    $\pgfmathparse{10^(#1)}\pgfmathprintnumber{\pgfmathresult}$%
  },
  cycle list/%COLOR_SCHEME%,
}

\begin{document}
\pagestyle{empty}

\newenvironment{resultAxis}{
\begin{axis}[
    width=350pt,
    height=96pt,
    xmin=0,
    ymin=0,
    %Y_MAX%
    % Don't show axis exponent
    ytick scale label code/.code={},
    scaled y ticks=false,
    x axis line style=-,
    scale only axis,
    clip=false,
    axis on top,
    xlabel={Time (ms)},
    ylabel={Query results},
    cycle list name=%COLOR_SCHEME%,
    every axis plot/.append style={line width=1pt},
    legend style={at={(1,0)},anchor=south east}
]
}{\end{axis}}
\begin{tikzpicture}
\begin{resultAxis}
%LINES%
\legend{%LEGEND%}
\end{resultAxis}
\end{tikzpicture}
\end{document}
