# Justification of the caption of a wrapfigure

I am trying to center the caption of a figure in latex.

\begin{wrapfigure}{r}{0.50 \textwidth}
\vspace{-20pt}
\begin{center}
\resizebox{0.5\linewidth}{!}{ \subimport{./Figures/}{vector.tex}}
\vspace{-10pt}
\captionsetup{margin=1.8cm}
\caption{Graphic representation of vectors}
\label{fig:vectors}
\end{center}
\vspace{-10pt}
\end{wrapfigure}


and my figure is done in another file as follows

\documentclass[float=false, crop=false]{standalone}
\usepackage[subpreambles=true]{standalone}
\usepackage{import}
\begin{document}
\begin{tikzpicture}
\draw[thin,gray!40] (-2,-2) grid (2,2);
\draw[line width=2pt,blue,-stealth](0,0)--(1,1) node[anchor=south west]{$\boldsymbol{}$};
\draw[line width=2pt,red,-stealth](-2,0)--(-1,1) node[anchor=south west]{$\boldsymbol{}$};
\draw[line width=2pt,green,-stealth](-1,-1)--(-2,-2) node[anchor=north east]{$\boldsymbol{}$};
\draw[line width=2pt,magenta,-stealth](2,0)--(1,-1) node[anchor=north east]{$\boldsymbol{}$};
\end{tikzpicture}
\end{document}


I would like to have the caption center and the figure a little bit larger so the figure is larger of the caption. I also would like that the text continues around the figure and not only in the left part of the figure.

Thanks

like this?

\documentclass{article}
\usepackage{tikz}
\usepackage{wrapfig}
\usepackage{caption}

\usepackage{lipsum}

\begin{document}
\lipsum [2]
\begin{wrapfigure}{r}{0.50 \textwidth}
\centering
\begin{tikzpicture}% image you can insert with \input{<path>/<file name>}
[scale=1.2,% increased image
L/.style = {draw=#1, line width=2pt,-stealth}% for simplified imnage code
]
\draw[thin,gray!40] (-2,-2) grid (2,2);
\draw[L=blue]     ( 0,0)  -- ( 1,1);
\draw[L=red]      (-2,0)  -- (-1,1);
\draw[L=green]    (-1,-1) -- (-2,-2);
\draw[L=magenta]  (2,0)   -- (1,-1);
\end{tikzpicture}
\captionsetup{margin=1.2cm}
\caption{Graphic representation of vectors}
\label{fig:vectors}
\end{wrapfigure}
\lipsum[1]
\end{document}


note: tikzpicture as tex file can not be scaled by \resizebox. if you like increase it size, you should use scale in image code or include image as pdf file and than use includegraphics[width=<length>]{<path>/<image name>}.

or you mean to have caption in centering justification?

for above caption i use

\captionsetup{margin=1cm,justification=centering}