[Tex/LaTex] Change figure caption name only in one figure, not all

captionsfloats

I saw here Change caption name of figures , by

\renewcommand{\figurename}{Fig.}

but if you do that, it changes all of the figures captions. How to change only some of them?

but I have 3 figures, I want default caption for figure 1 and 3, but Photo caption for figure 2.

so it should be like, Figure 1, Photo 1, Figure 2.

\begin{figure} 
      ...
      \caption{This is a figure.}
\end{figure}


\begin{figure} 
       ....
       \caption{This is a photo.}
\end{figure}


\begin{figure}
       ...
       \caption{This is a figure.}
\end{figure}

Best Answer

do it inside the environment, then it is local:

\begin{figure} 
   \renewcommand\figurename{Fig.}
       ....
       \caption{This is a photo.}
\end{figure}