Schemes as set valued functors on the category of affine schemes Let $\mathcal{Sch}$ be the category of schemes.
Let $\mathcal{Aff}$ be the category of affine schemes.
Let $\mathcal{Sets}$ be the category of sets.
Let $X$ be a scheme.
Let $h_X\colon \mathcal{Sch}^{op} \rightarrow \mathcal{Sets}$ be the functor defined by $h_X(T) = Hom(T, X)$.
By Yoneda lemma, $h_X \cong h_Y$ if and only if $X \cong Y$.
Let $g_X\colon \mathcal{Aff}^{op} \rightarrow \mathcal{Sets}$ be the restriction of $h_X$.
Then $g_X \cong g_Y$ if and only if $X \cong Y$?
 A: Yes.  This is a consequence of the Yoneda Lemma result that you cite, together with the fact that any scheme has an open cover by affine schemes, and that morphisms of schemes can be constructed by working locally and then gluing.
A: Let $\psi\colon g_X \rightarrow g_Y$ be a natural transformation.
We construct a morphism $f\colon X \rightarrow Y$ inducing $\psi$ as follows.
Let $(U_i)_{i \in I}$ be an affine open cover of $X$.
Let $\tau_i\colon U_i \rightarrow X$ be the canonical morphism.
Let $f_i = \psi_{U_i}(\tau_i) \colon U_i \rightarrow Y$.
We get the following commutative diagram.
$$\begin{matrix}
g_X(U_i)&\stackrel{\psi_{U_i}}{\rightarrow}&g_Y(U_i)\\
\downarrow&&\downarrow\\
g_X(U_i\cap U_j)&\stackrel{\psi_{U_i\cap U_j}}{\rightarrow}&g_Y(U_i\cap U_j)
\end{matrix}
$$
By the above diagram, $f_i = f_j$ on $U_i \cap U_j$.
Hence there exists a unique morphism $f\colon X \rightarrow Y$ such that $f|U_i = f_i$.
Let $S$ be an affine scheme, $h\colon S \rightarrow X$ a morphism.
We will show $fh = \psi_S(h)$.
Let $x \in S$. There exists $i \in I$ such that $h(x) \in U_i$.
Since $h$ is continuous, there exists an affine open neighborhood $V_x$ of $x$ such that $h(V_x) \subset U_i$.
Hence there exists an affine open cover $(V_j)_{j\in J}$ with the following property.
For each $j \in J$, there exists $i \in I$ such that $h(V_j) \subset U_i$.
Hence there exists a map $\phi\colon J \rightarrow I$ such that $h(V_j) \subset U_{\phi(j)}$ for each $j \in J$. Let $h'_j\colon V_j \rightarrow U_{\phi(j)}$ be the morphism induced by $h$.
Let $h_j = \tau_{\phi(j)} h'_j \colon V_j \rightarrow X$.
$$\begin{matrix}
g_X(U_{\phi(j)})&\stackrel{\psi_{U_{\phi(j)}}}{\rightarrow}&g_Y(U_{\phi(j)})\\
\downarrow&&\downarrow\\
g_X(V_j)&\stackrel{\psi_{V_j}}{\rightarrow}&g_Y(V_j)
\end{matrix}
$$
By the above commutative diagram, $\psi_{V_j}(h_j) = fh_j$.
$$\begin{matrix}
g_X(S)&\stackrel{\psi_S}{\rightarrow}&g_Y(S)\\
\downarrow&&\downarrow\\
g_X(V_j)&\stackrel{\psi_{V_j}}{\rightarrow}&g_Y(V_j)
\end{matrix}
$$
By the above commutative diagram, $\psi_S(h)|V_j = fh|V_j$ for each $j \in J$.
Hence $\psi_S(h) = fh$.
Therefore $f$ induces $\psi$.
Suppose $\psi\colon g_X \rightarrow g_Y$ is a natural equivalence.
Then, by the above argument, there exists a morphism $f'\colon Y \rightarrow X$ inducing $\psi^{-1}$.
Since $f'f$ induces the identity on $h_X$, $f'f = id_X$.
Similarly $ff' = id_Y$.
Hence $f$ is an isomorphism.
