Yes, thanks. The \scalebox needs to directly affect the \includegraphics command and so if you try to apply it to the whole figure environment (\begin{figure}...\end{figure}), then you will likely get an error since it will also try to scale the floats, captions, etc.