A scheme is affine iff the natural map $X\to \operatorname{Spec}\Gamma(X)$ is an isomorphism

Consider an arbitrary left adjoint $L : C \to D$ with right adjoint $R$. In the situation at hand $C$ is schemes, $D$ is affine schemes, $R$ is the inclusion of affine schemes into schemes, and $L$ is the affinization functor $X \mapsto \text{Spec } \Gamma(X)$. An adjunction comes with a unit natural transformation

$$\eta : \text{id}_C \to RL$$

and a counit natural transformation

$$\varepsilon : LR \to \text{id}_D.$$

Exercise 0: Any adjunction defines an equivalence of categories between the subcategory of $C$ consisting of objects $c \in C$ such that the unit $\eta_c : c \to RLc$ is an isomorphism and the subcategory of $D$ consisting of objects $d \in D$ such that the counit $\varepsilon_d : LRd \to d$ is an isomorphism.

In general it's an interesting problem to identify what these subcategories are.

Exercise 1: $R$ is fully faithful iff the counit $\varepsilon_d : LRd \to d$ is always an isomorphism.

Exercise 2: Exercise 1 implies that if $R$ is fully faithful, then the adjunction above restricts to an equivalence of categories between $D$ and the subcategory of $C$ such that the unit $\eta_c : c \to RLc$ is an isomorphism.

Because the inclusion of affine schemes into schemes is indeed fully faithful, it follows that a scheme is affine iff $X \mapsto \text{Spec } \Gamma(X)$ is an isomorphism.

There are several ways to describe this situation. One is that $D$ is a reflective subcategory of $C$. Another is that the monad $M = RL$ on $C$ induced by the above adjunction is idempotent, and $D$ ends up being identified with algebras over this monad. A familiar example is the adjunction between groups and abelian groups: here we have that a group $G$ is abelian iff the abelianization map $G \to G/[G, G]$ is an isomorphism.


$\DeclareMathOperator{\Spec}{Spec}$ Let $X = \Spec A$ for some ring $A$. Then $\Gamma(X)=A$ by definition of the structure sheaf on $X$. Applying $\Spec$ to the identity map $\Gamma(X)\rightarrow A$ yields an isomorphism of affine schemes $$ f\colon X = \Spec A \longrightarrow \Spec \Gamma(X), $$ since $\Gamma(X)\rightarrow A$ is an isomorphism and $\Spec$ is functorial. Also note that $f$ is indeed the canonical morphism $X\rightarrow \Spec \Gamma(X)$.