Let $f:X\rightarrow Y$ be a morphism of schemes. We know that if $Y$ is affine and $f$ induces homeomorphism on the underlying spaces then $X$ is affine. Is it true that if $X$ is affine and $f$ induces a homeomorphism on the underlying spaces then $Y$ is affine?
More generally, is it true that a scheme whose underlying space is homeomorphic (possibly via a homeomorphism that is not induced by a morphism of schemes) to the underlying space of an affine scheme is affine? EDIT: actually, the answer to the last question is a very strong "NO" as the underlying space of any scheme is sober and Noetherian sober spaces are spectral (i.e. homeomorphic to the underlying space of an affine scheme).