I have the following matrix:

which is obtained from the following code:
\usetikzlibrary{patterns}
\usetikzlibrary{matrix,decorations.pathreplacing,calc}
%opening
\title{}
\author{}
\pgfkeys{tikz/mymatrixenv/.style={decoration={brace},every left delimiter/.style={xshift=8pt},every right delimiter/.style={xshift=-8pt}}}
\pgfkeys{tikz/mymatrix/.style={matrix of math nodes,nodes in empty cells,left delimiter={[},right delimiter={]},inner sep=1pt,outer sep=1.5pt,column sep=8pt,row sep=8pt,nodes={minimum width=20pt,minimum height=10pt,anchor=center,inner sep=0pt,outer sep=0pt}}}
\pgfkeys{tikz/mymatrixbrace/.style={decorate,thick}}
\newcommand*\mymatrixbraceright[4][m]{
\draw[mymatrixbrace] (#1.west|-#1-#3-1.south west) -- node[left=2pt] {#4} (#1.west|-#1-#2-1.north west);
}
\newcommand*\mymatrixbraceleft[4][m]{
\draw[mymatrixbrace] (#1.east|-#1-#2-1.north east) -- node[right=2pt] {#4} (#1.east|-#1-#2-1.south east);
}
\newcommand*\mymatrixbracetop[4][m]{
\draw[mymatrixbrace] (#1.north-|#1-1-#2.north west) -- node[above=2pt] {#4} (#1.north-|#1-1-#3.north east);
}
\newcommand*\mymatrixbracebottom[4][m]{
\draw[mymatrixbrace] (#1.south-|#1-1-#2.north east) -- node[below=2pt] {#4} (#1.south-|#1-1-#3.north west);
}
\tikzset{style green/.style={
set fill color=green!50!lime!60,draw opacity=0.4,
set border color=green!50!lime!60,fill opacity=0.1,
},
style cyan/.style={
set fill color=cyan!90!blue!60, draw opacity=0.4,
set border color=blue!70!cyan!30,fill opacity=0.1,
},
style orange/.style={
set fill color=orange!90, draw opacity=0.8,
set border color=orange!90, fill opacity=0.3,
},
style brown/.style={
set fill color=brown!70!orange!40, draw opacity=0.4,
set border color=brown, fill opacity=0.3,
},
style purple/.style={
set fill color=violet!90!pink!20, draw opacity=0.5,
set border color=violet, fill opacity=0.3,
},
kwad/.style={
above left offset={-0.1,0.23},
below right offset={0.10,-0.36},
#1
},
pion/.style={
above left offset={-0.07,0.2},
below right offset={0.07,-0.32},
#1
},
poz/.style={
above left offset={-0.03,0.18},
below right offset={0.03,-0.3},
#1
}
}
\[
% \mathbf{X} =
\begin{tikzpicture}[baseline={-0.5ex},mymatrixenv]
\matrix [mymatrix,inner sep=4pt] (m)
{
\tikzmarkin[kwad=style green]{Prime} v_{1,1} & v_{1,2} & \tikzmarkin[pion=style purple]{VL} v_{1,3} & \textcolor{white}{v_{1,4}} & & \textcolor{white}{v_{1,6}} \\
v_{2,1} & v_{2,2} & v_{2,3} & & & \\
\tikzmarkin[poz=style brown]{HL} v_{3,1} & v_{3,2} & \tikzmarkin[kwad=style orange]{Mix} v_{3,3} \tikzmarkend{Prime} &\tikzmarkin[pion=style purple]{VR} v_{3,4} \tikzmarkend{HL} & & \\
\textcolor{white}{v_{4,1}} & & \tikzmarkin[poz=style brown]{HR} v_{4,3} \tikzmarkend{VL}& \tikzmarkin[kwad=style cyan]{Bis} v_{4,4} \tikzmarkend{Mix} & v_{4,5} & v_{4,6} \tikzmarkend{HR} \\
& & & v_{5,4} & v_{5,5} & v_{5,6} \\
\textcolor{white}{v_{6,1}} & & & v_{6,4} \tikzmarkend{VR} & v_{6,5} & v_{6,6} \tikzmarkend{Bis} \\
};
% Braces
\mymatrixbraceright{1}{3}{$B'$}
\mymatrixbraceright{4}{6}{$B''$}
\mymatrixbracetop{1}{3}{$C'$}
\mymatrixbracetop{4}{6}{$C''$}
\mymatrixbracebottom{3}{3}{$F'$}
\mymatrixbracebottom{4}{4}{$F''$}
\mymatrixbraceleft{3}{3}{$E'$}
\mymatrixbraceleft{4}{4}{$E''$}
\end{tikzpicture}
\]
I was trying to change:
\begin{tikzpicture}[baseline={-0.5ex},mymatrixenv]
to
\begin{tikzpicture}[scale=2,baseline={-0.5ex},mymatrixenv]
but without effect.
I also tried this when I import the picture to another document:
\begin{figure}
\centering
\scalebox{2}{
\input{color_matrix3.tikz}
}
\end{figure}
the output was indeed bigger but not centered and latex gave a lot of errors concerning math equations


\usepackage{adjustbox} ... \adjustbox{scale=2,center}{...}or\begin{adjustbox}{scale=2,center}...\end{adjustbox}. Instead ofscale=2maybe awidth=\textwidthor some other length is more suitable. – Martin Scharrer Dec 28 '18 at 12:13